#971·benchmark

[BUG] Infinite running benchmarks

Author: KashioCreated Jun 3, 2020Updated Sep 2, 2026

Describe the bug Benchmarks fixture don't seem to run unless in debug with breakpoints

System

  • OS: Windows 10 x64
  • Compiler and version: msvc 19.16.27034 x32/x64 (both)

To reproduce You can clone my repository https://github.com/Kashio/A5 and build with cmake

Expected behavior Benchmarks should run normally and not get stuck somewhere infinitely

Additional context If I place a break pointer in my first defined benchmark function BENCHMARK_F(MultipleFixedAllocations, CAllocator)(benchmark::State& state) and step through it to completion (by stepping into BenchmarkMultipleAllocations and then setting another breakpoint at the end of BenchmarkMultipleAllocations and jumping to it) Then I manage somehow to get the first benchmark case finished, but unless I'm stepping through code with breakpoints and just running it then it get stuck somewhere and never finishes and memory goes up (probably by my allocators objects since they're never freed) but it's as if it constructing them infinitely or something but I'm not even sure about that since I even placing breakpoints on their constructors don't get hit.

You can go to this commit https://github.com/Kashio/A5/tree/25aa53e372a4c6ae5cc02358383ac1d06f137792 which was before I've changed the benchmark function to fixtures. Before doing that everything worked fine. The reason I had to change that to fixtures instead of globally defined functions is that I wanted some setup code specific for these cases as can be seen on the master.

I'm not sure this is a bug, probably me not doing something right with setting the fixture tests. I'm pretty sure this is not a bug in my library code causing it since I've linked to a commit where everything worked fine without fixtures.

Here's a gif showing the problem that no tests are run and the memory just keeping going up: https://gfycat.com/physicalimmaterialgallinule

And Here's the same run with me just stepping with breakpoint and see how the first test somehow finished but then everything get stuck again: https://gfycat.com/windyphonydamselfly