Comments (1)
Thanks for pointing this out.
For reference, I ran benchmark_test under Valgrind 3.9.0 and found (with --leak-check=full
):
36 bytes in 1 blocks are possibly lost in loss record 25 of 52
at 0x4C2B050: operator new(unsigned long) (vg_replace_malloc.c:319)
by 0x5109FC8: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x510B710: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x510BB37: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x4209D9: benchmark::internal::Benchmark::Benchmark(char const*, std::function<void (benchmark::State&)>) (benchmark.cc:600)
by 0x41C6E0: __static_initialization_and_destruction_0(int, int) (benchmark_test.cc:144)
by 0x41C90F: _GLOBAL__sub_I_main (benchmark_test.cc:153)
by 0x42BE4C: __libc_csu_init (in /home/ckennelly/projects/benchmark/benchmark_test)
by 0x58839F4: (below main) (in /lib64/libc-2.19.so)
37 bytes in 1 blocks are possibly lost in loss record 26 of 52
at 0x4C2B050: operator new(unsigned long) (vg_replace_malloc.c:319)
by 0x5109FC8: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x510B710: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x510BB37: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x4209D9: benchmark::internal::Benchmark::Benchmark(char const*, std::function<void (benchmark::State&)>) (benchmark.cc:600)
by 0x41C358: __static_initialization_and_destruction_0(int, int) (benchmark_test.cc:50)
by 0x41C90F: _GLOBAL__sub_I_main (benchmark_test.cc:153)
by 0x42BE4C: __libc_csu_init (in /home/ckennelly/projects/benchmark/benchmark_test)
by 0x58839F4: (below main) (in /lib64/libc-2.19.so)
37 bytes in 1 blocks are possibly lost in loss record 27 of 52
at 0x4C2B050: operator new(unsigned long) (vg_replace_malloc.c:319)
by 0x5109FC8: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x510B710: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x510BB37: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x4209D9: benchmark::internal::Benchmark::Benchmark(char const*, std::function<void (benchmark::State&)>) (benchmark.cc:600)
by 0x41C517: __static_initialization_and_destruction_0(int, int) (benchmark_test.cc:85)
by 0x41C90F: _GLOBAL__sub_I_main (benchmark_test.cc:153)
by 0x42BE4C: __libc_csu_init (in /home/ckennelly/projects/benchmark/benchmark_test)
by 0x58839F4: (below main) (in /lib64/libc-2.19.so)
39 bytes in 1 blocks are possibly lost in loss record 28 of 52
at 0x4C2B050: operator new(unsigned long) (vg_replace_malloc.c:319)
by 0x5109FC8: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x510B710: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x510BB37: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x4209D9: benchmark::internal::Benchmark::Benchmark(char const*, std::function<void (benchmark::State&)>) (benchmark.cc:600)
by 0x41C406: __static_initialization_and_destruction_0(int, int) (benchmark_test.cc:70)
by 0x41C90F: _GLOBAL__sub_I_main (benchmark_test.cc:153)
by 0x42BE4C: __libc_csu_init (in /home/ckennelly/projects/benchmark/benchmark_test)
by 0x58839F4: (below main) (in /lib64/libc-2.19.so)
39 bytes in 1 blocks are possibly lost in loss record 29 of 52
at 0x4C2B050: operator new(unsigned long) (vg_replace_malloc.c:319)
by 0x5109FC8: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x510B710: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x510BB37: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x4209D9: benchmark::internal::Benchmark::Benchmark(char const*, std::function<void (benchmark::State&)>) (benchmark.cc:600)
by 0x41C461: __static_initialization_and_destruction_0(int, int) (benchmark_test.cc:71)
by 0x41C90F: _GLOBAL__sub_I_main (benchmark_test.cc:153)
by 0x42BE4C: __libc_csu_init (in /home/ckennelly/projects/benchmark/benchmark_test)
by 0x58839F4: (below main) (in /lib64/libc-2.19.so)
39 bytes in 1 blocks are possibly lost in loss record 30 of 52
at 0x4C2B050: operator new(unsigned long) (vg_replace_malloc.c:319)
by 0x5109FC8: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x510B710: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x510BB37: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x4209D9: benchmark::internal::Benchmark::Benchmark(char const*, std::function<void (benchmark::State&)>) (benchmark.cc:600)
by 0x41C4C1: __static_initialization_and_destruction_0(int, int) (benchmark_test.cc:72)
by 0x41C90F: _GLOBAL__sub_I_main (benchmark_test.cc:153)
by 0x42BE4C: __libc_csu_init (in /home/ckennelly/projects/benchmark/benchmark_test)
by 0x58839F4: (below main) (in /lib64/libc-2.19.so)
41 bytes in 1 blocks are possibly lost in loss record 31 of 52
at 0x4C2B050: operator new(unsigned long) (vg_replace_malloc.c:319)
by 0x5109FC8: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x510B710: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x510BB37: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x4209D9: benchmark::internal::Benchmark::Benchmark(char const*, std::function<void (benchmark::State&)>) (benchmark.cc:600)
by 0x41C63C: __static_initialization_and_destruction_0(int, int) (benchmark_test.cc:112)
by 0x41C90F: _GLOBAL__sub_I_main (benchmark_test.cc:153)
by 0x42BE4C: __libc_csu_init (in /home/ckennelly/projects/benchmark/benchmark_test)
by 0x58839F4: (below main) (in /lib64/libc-2.19.so)
41 bytes in 1 blocks are possibly lost in loss record 32 of 52
at 0x4C2B050: operator new(unsigned long) (vg_replace_malloc.c:319)
by 0x5109FC8: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x510B710: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x510BB37: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x4209D9: benchmark::internal::Benchmark::Benchmark(char const*, std::function<void (benchmark::State&)>) (benchmark.cc:600)
by 0x41C693: __static_initialization_and_destruction_0(int, int) (benchmark_test.cc:135)
by 0x41C90F: _GLOBAL__sub_I_main (benchmark_test.cc:153)
by 0x42BE4C: __libc_csu_init (in /home/ckennelly/projects/benchmark/benchmark_test)
by 0x58839F4: (below main) (in /lib64/libc-2.19.so)
44 bytes in 1 blocks are possibly lost in loss record 33 of 52
at 0x4C2B050: operator new(unsigned long) (vg_replace_malloc.c:319)
by 0x5109FC8: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x510B710: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x510BB37: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x4209D9: benchmark::internal::Benchmark::Benchmark(char const*, std::function<void (benchmark::State&)>) (benchmark.cc:600)
by 0x41C3A6: __static_initialization_and_destruction_0(int, int) (benchmark_test.cc:61)
by 0x41C90F: _GLOBAL__sub_I_main (benchmark_test.cc:153)
by 0x42BE4C: __libc_csu_init (in /home/ckennelly/projects/benchmark/benchmark_test)
by 0x58839F4: (below main) (in /lib64/libc-2.19.so)
54 bytes in 1 blocks are possibly lost in loss record 34 of 52
at 0x4C2B050: operator new(unsigned long) (vg_replace_malloc.c:319)
by 0x5109FC8: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x510B710: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x510BB37: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x4209D9: benchmark::internal::Benchmark::Benchmark(char const*, std::function<void (benchmark::State&)>) (benchmark.cc:600)
by 0x41C5E2: __static_initialization_and_destruction_0(int, int) (benchmark_test.cc:101)
by 0x41C90F: _GLOBAL__sub_I_main (benchmark_test.cc:153)
by 0x42BE4C: __libc_csu_init (in /home/ckennelly/projects/benchmark/benchmark_test)
by 0x58839F4: (below main) (in /lib64/libc-2.19.so)
56 bytes in 1 blocks are possibly lost in loss record 35 of 52
at 0x4C2B050: operator new(unsigned long) (vg_replace_malloc.c:319)
by 0x5109FC8: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x510B710: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x510BB37: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.2/libstdc++.so.6.0.18)
by 0x4209D9: benchmark::internal::Benchmark::Benchmark(char const*, std::function<void (benchmark::State&)>) (benchmark.cc:600)
by 0x41C582: __static_initialization_and_destruction_0(int, int) (benchmark_test.cc:100)
by 0x41C90F: _GLOBAL__sub_I_main (benchmark_test.cc:153)
by 0x42BE4C: __libc_csu_init (in /home/ckennelly/projects/benchmark/benchmark_test)
by 0x58839F4: (below main) (in /lib64/libc-2.19.so)
256 bytes in 1 blocks are definitely lost in loss record 50 of 52
at 0x4C2B600: malloc (vg_replace_malloc.c:291)
by 0x5930157: regcomp (in /lib64/libc-2.19.so)
by 0x42170E: benchmark::internal::Benchmark::FindBenchmarks(std::string const&, std::vector<benchmark::internal::Benchmark::Instance, std::allocator<benchmark::internal::Benchmark::Instance> >*) (benchmark.cc:749)
by 0x422F1C: benchmark::internal::RunMatchingBenchmarks(std::string const&, benchmark::BenchmarkReporter const*) (benchmark.cc:1138)
by 0x423309: benchmark::RunSpecifiedBenchmarks(benchmark::BenchmarkReporter const*) (benchmark.cc:1190)
by 0x41C0F0: main (benchmark_test.cc:152)
2,640 (224 direct, 2,416 indirect) bytes in 1 blocks are definitely lost in loss record 52 of 52
at 0x4C2B600: malloc (vg_replace_malloc.c:291)
by 0x4C2B89F: realloc (vg_replace_malloc.c:687)
by 0x592F92E: re_compile_internal (in /lib64/libc-2.19.so)
by 0x59301BF: regcomp (in /lib64/libc-2.19.so)
by 0x42170E: benchmark::internal::Benchmark::FindBenchmarks(std::string const&, std::vector<benchmark::internal::Benchmark::Instance, std::allocator<benchmark::internal::Benchmark::Instance> >*) (benchmark.cc:749)
by 0x422F1C: benchmark::internal::RunMatchingBenchmarks(std::string const&, benchmark::BenchmarkReporter const*) (benchmark.cc:1138)
by 0x423309: benchmark::RunSpecifiedBenchmarks(benchmark::BenchmarkReporter const*) (benchmark.cc:1190)
by 0x41C0F0: main (benchmark_test.cc:152)
LEAK SUMMARY:
definitely lost: 480 bytes in 2 blocks
indirectly lost: 2,416 bytes in 16 blocks
possibly lost: 463 bytes in 11 blocks
still reachable: 1,700 bytes in 24 blocks
suppressed: 0 bytes in 0 blocks
Valgrind also found a race condition in our multi-threaded example during cleanup. I found this when I was running Valgrind with no arguments (it doesn't show up when I used --leak-check=full
, but such is the nature of race conditions):
Invalid read of size 8
at 0x41CCD2: std::vector<int, std::allocator<int> >::push_back(int const&) (stl_vector.h:903)
by 0x41BF3E: BM_SetupTeardown(benchmark::State&) (benchmark_test.cc:124)
by 0x41D06A: std::_Function_handler<void (benchmark::State&), void (*)(benchmark::State&)>::_M_invoke(std::_Any_data const&, benchmark::State&) (functional:2071)
by 0x425334: std::function<void (benchmark::State&)>::operator()(benchmark::State&) const (functional:2464)
by 0x422D9D: benchmark::State::Run() (benchmark.cc:1110)
by 0x422EC1: benchmark::State::RunWrapper(void*) (benchmark.cc:1127)
by 0x4E3B072: start_thread (in /lib64/libpthread-2.19.so)
by 0x594A44C: clone (in /lib64/libc-2.19.so)
Address 0x783ce18 is 8 bytes inside a block of size 24 free'd
at 0x4C29F1C: operator delete(void*) (vg_replace_malloc.c:502)
by 0x41BF98: BM_SetupTeardown(benchmark::State&) (benchmark_test.cc:131)
by 0x41D06A: std::_Function_handler<void (benchmark::State&), void (*)(benchmark::State&)>::_M_invoke(std::_Any_data const&, benchmark::State&) (functional:2071)
by 0x425334: std::function<void (benchmark::State&)>::operator()(benchmark::State&) const (functional:2464)
by 0x422D9D: benchmark::State::Run() (benchmark.cc:1110)
by 0x422EC1: benchmark::State::RunWrapper(void*) (benchmark.cc:1127)
by 0x4E3B072: start_thread (in /lib64/libpthread-2.19.so)
by 0x594A44C: clone (in /lib64/libc-2.19.so)
I'll look into writing a fix for this.
from benchmark.
Related Issues (20)
- [BUG] Missing `\n` at the End of Console Output HOT 2
- [FR] Enforce CMake to find PFM or fail when `BENCHMARK_ENABLE_LIBPFM` is `ON` HOT 2
- [BUG] QNX compilation failure on v1.8.3. Patch suggestion. HOT 2
- [BUG] mismatch of macro name for cmake
- [FR] Define HOST_NAME_MAX for z/OS HOT 1
- [FR] Add z/OS case to ThreadCPUUsage to avoid error HOT 1
- [BUG] fail to import gbench into compare.py with bazel and python3.12
- [FR] Large File Support HOT 5
- [FR] Support Win32 on Windows HOT 1
- [BUG] Console created through AllocConsole does not receive colored output HOT 3
- [BUG] Result of run with --benchmark_list_tests=true may not show on console
- [FR] JSON AoS<->SoA redesign HOT 6
- Migrate to bzlmod HOT 9
- [BUG] 1.8.3: build fails with gcc 14.x HOT 4
- [FR] Add `CMake` option to disable `benchmark_main` target HOT 2
- [BUG] Weird behavior of bytes_per_second and items_per_second HOT 8
- [FR] cp312 release on pypi
- [BUG] Reported iterations per run when using repetitions always the same value? HOT 3
- [BUG] With NDEBUG, early-returning without SkipWithError leads to indefinite retries HOT 5
- Complexity calculation does not work for manual timing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from benchmark.