> On Dec. 9, 2014, 8:55 p.m., Dominic Hamon wrote:
> > 3rdparty/libprocess/src/tests/benchmarks.cpp, line 342
> > <https://reviews.apache.org/r/28871/diff/1/?file=787253#file787253line342>
> >
> >     please consider unique_ptr to avoid explicit delete calls.

We should first decide how we want to introduce this new construct, as there 
are a number of things to consider in the context of our large project :)

I believe Joris' is planning to seed a discussion around this, note that there 
is only one unique_ptr in our entire code base currently. It slipped in but is 
being removed in this change: https://reviews.apache.org/r/27113/

```
3rdparty/libprocess/src/tests/benchmarks.cpp:using std::unique_ptr;
3rdparty/libprocess/src/tests/benchmarks.cpp:      
vector<unique_ptr<BenchmarkProcess>> benchmarkProcesses;
3rdparty/libprocess/src/tests/benchmarks.cpp:        
benchmarkProcesses.push_back(unique_ptr<BenchmarkProcess>(process));
```

This code seems a bit unfortunate, because we're using a raw pointer that is 
owned by a unique_ptr!

```
      vector<unique_ptr<BenchmarkProcess>> benchmarkProcesses;
      for (int i = 0; i < clients; ++i) {
        BenchmarkProcess* process = new BenchmarkProcess(
            iterations,
            queueDepth,
            other);
        benchmarkProcesses.push_back(unique_ptr<BenchmarkProcess>(process));
        spawn(process); // Yikes!!
        process->start(); // Yikes!!
      }
```

Dominic, feel free to seed the discussion on the style guide or the mailing 
list, that seems like the right place :)


- Ben


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/28871/#review64434
-----------------------------------------------------------


On Dec. 9, 2014, 11:15 p.m., Jie Yu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/28871/
> -----------------------------------------------------------
> 
> (Updated Dec. 9, 2014, 11:15 p.m.)
> 
> 
> Review request for mesos, Ben Mahler and Joris Van Remoortere.
> 
> 
> Bugs: MESOS-2182
>     https://issues.apache.org/jira/browse/MESOS-2182
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Added a benchmark to test large number of links for MESOS-2182.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/src/tests/benchmarks.cpp 
> 227b8e7ae5f855918073b7b3ea89d773a39aa8fa 
> 
> Diff: https://reviews.apache.org/r/28871/diff/
> 
> 
> Testing
> -------
> 
> make check
> ./benchmarks
> 
> 
> Thanks,
> 
> Jie Yu
> 
>

Reply via email to