Release memory pages for thread data (allocator cache, stack allocations
ring buffer, etc) when a thread exits. We can not simply munmap them
because this memory is custom allocated within a limited address range,
and it needs to stay "reserved".
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
This one is hard to test reliably for RSS change, because it only affect thread exit, and, generally, we don't know how much memory the platform thread support would release in that event, and it might even be a different amount for different threads (some kind of stack caching, etc).
We don't rely on ReleaseMemoryPagesToOS clearing memory here, so this an almost side-effect-free optimization.
PTAL.
compiler-rt/lib/hwasan/hwasan_thread_list.h | ||
---|---|---|
186 ↗ | (On Diff #181389) | Would it help to release memory starting from the original value of free_space_ here? It seems that you would be able to probabilistically free a fraction of a page more that way. Or am I missing something? |