easy_profiler icon indicating copy to clipboard operation
easy_profiler copied to clipboard

[Question] how to prevent multithread problem in chunk_alloctor?

Open gggin opened this issue 2 years ago • 1 comments

  1. chunk_allocator allocate function change last pointer when memory need be allocate
  2. chunk_allocator invert function will be called in serialize function and also use last->prev and last pointer

Question1: 1 and 2 will cause multithread problem? Question2: if Question 1 is true, where is code to handle this, or this is a bug?

gggin avatar Nov 27 '23 06:11 gggin

After some survey I find:

ProfileManager::dumpBlocksToStream function will set m_profilerStatus.store(false, std::memory_order_release); that isEnable be setted into false and every endBlock function will check this atomic variable and then give all endBlock 20ms to finish calls

so endBlock 's call chunk_allocator's allocate function will never call with serialize function

gggin avatar Mar 05 '24 08:03 gggin