Open malkia opened 3 weeks ago
Hi @malkia -- ah, no worries -- this is handled well. In particular, when a thread terminates the _mi_thread_done
is called which will "abandon" all segments and set their thread-id to 0 (and preventing reused thread-id issues). Btw. we need to keep the segments alive since they contain still live data resulting from pointers that are shared with other threads). Later, other threads can "reclaim" such abandoned segments (see _mi_segment_try_reclaim
) and reuse the memory that was abandoned.
Awesome - thank you so much! This makes it for another re-reading of the source code! Much appreciated!
Scenario:
Does mimalloc handle this case gracefully?