diff options
author | Chris Kennelly <ckennelly@ckennelly.com> | 2014-04-23 01:17:47 -0700 |
---|---|---|
committer | Chris Kennelly <ckennelly@ckennelly.com> | 2014-04-23 01:17:47 -0700 |
commit | 9f27edbb1650c297f511c4b52e563ee3f0619348 (patch) | |
tree | b660b772ed69bef451730474f9aaaa8defa0eea7 /include/benchmark | |
parent | fa908926c7ab9270037e2ab71036f8f6f87e9850 (diff) | |
download | google-benchmark-9f27edbb1650c297f511c4b52e563ee3f0619348.tar.gz |
Resolve memory leak from benchmark instances in google/benchmark#17.
This shifts registration from a global vector to a singleton that manages
benchmark destruction during shutdown.
Diffstat (limited to 'include/benchmark')
-rw-r--r-- | include/benchmark/benchmark.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/include/benchmark/benchmark.h b/include/benchmark/benchmark.h index 977e646..e7ec531 100644 --- a/include/benchmark/benchmark.h +++ b/include/benchmark/benchmark.h @@ -178,6 +178,7 @@ void UseRealTime(); namespace internal { class Benchmark; +class BenchmarkFamilies; } // State is passed to a running Benchmark and contains state for the @@ -444,15 +445,12 @@ class Benchmark { // Used inside the benchmark implementation struct Instance; - // Extract the list of benchmark instances that match the specified - // regular expression. - static void FindBenchmarks(const std::string& re, - std::vector<Instance>* benchmarks); - // Measure the overhead of an empty benchmark to subtract later. static void MeasureOverhead(); private: + friend class BenchmarkFamilies; + std::vector<Benchmark::Instance> CreateBenchmarkInstances(int rangeXindex, int rangeYindex); |