You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When a Memory Manager class is registered, the results of each iteration are appended to an std::vector, and a pointer to the newly added element is used as a reference thereafter.
However, when the vector automatically resizes, these pointers become invalid, leading to corrupted statistical measurements.
The problem only occurs if the number of repetitions is greater than one.
To reproduce
Steps to reproduce the behavior:
Register a Memory Manager class
Run any benchmark with at least 3 repetitions
User the Json reporter to see the corrupted memory related stats.
Expected behavior
Pointers to stored values should remain valid, or the implementation should ensure they are updated correctly when the vector reallocates.
Additional context
Possible fixes:
Use std::list or instead of std::vector to avoid reallocation issues.
Store indices instead of pointers if possible.
Reserve GetNumRepeats() values to the std::vector to ensure no automatic growth is performed.
The text was updated successfully, but these errors were encountered:
Describe the bug
When a
Memory Manager
class is registered, the results of each iteration are appended to an std::vector, and a pointer to the newly added element is used as a reference thereafter.benchmark/src/benchmark_runner.cc
Lines 434 to 435 in 8d4fdd6
However, when the vector automatically resizes, these pointers become invalid, leading to corrupted statistical measurements.
The problem only occurs if the number of repetitions is greater than one.
To reproduce
Steps to reproduce the behavior:
Memory Manager
classExpected behavior
Pointers to stored values should remain valid, or the implementation should ensure they are updated correctly when the vector reallocates.
Additional context
Possible fixes:
std::list
or instead ofstd::vector
to avoid reallocation issues.GetNumRepeats()
values to thestd::vector
to ensure no automatic growth is performed.The text was updated successfully, but these errors were encountered: