Potential issue with threads that only deallocate
Author: guangli-daiCreated Oct 28, 2022Updated Sep 11, 2026
With the modifications in the latest PR #2349, a thread that only deallocates memory may cause a memory leak at a VERY SMALL POSSIBILITY, only when satisfying BOTH CONDITIONS below.
- The thread only deallocates memory during its life time and has NEVER allocated any memory.
- The total number of deallocations called by this thread reaches the threshold, i.e., 128 times, while the thread is being killed, i.e., pthread_exit has been reached but libc is still deallocating memory.
Source: jemalloc/jemalloc