yse / easy_profiler

Lightweight profiler library for c++
MIT License
2.15k stars 184 forks source link

BlocksList::clearClosed() does not call clear() for chunk_allocator #148

Open tkalbitz opened 5 years ago

tkalbitz commented 5 years ago

When captured blocks are dumped ThreadStorage::clearClosed() is called to free up memory from the already dumped blocks. The function delegates the task to two instance of struct BlocksList via BlockList::clearClosed().

To free the memory clear() must be called on chunk_allocator. This is commented out. This was introduce in a refactoring commit from September 2017.

The memory is not reused and will grow each time the capturing is started instead of reusing already dumped profiling data. When clear() is called the behavior as expected. Memory will be freed and no further grow is visible. I did test this on a Linux x86_64 without testing for race conditions or undefined behavior via sanitizer.

cas4ey commented 5 years ago

@tkalbitz thanks a lot for investigation!