malloc: Trim unused arenas on thread exit
Siddhesh Poyarekar
siddhesh@gotplt.org
Wed Nov 15 14:18:00 GMT 2017
On Wednesday 15 November 2017 07:40 PM, Florian Weimer wrote:
>
> I assumed the comment was sufficient:
>
>>> static void __attribute__ ((section ("__libc_thread_freeres_fn")))
>>> arena_thread_freeres (void)
>>> {
>>> + /* Shut down the thread cache first. This could deallocate data for
>>> + the thread arena, so do this before we put the arena on the free
>>> + list. */
>>> + tcache_thread_shutdown ();
>
> If it is not, we need to put more documentation in the code itself.
The comment describes the current behaviour while the commit log should
describe the change, something like:
"Call tcache destructor in arena_thread_freeres
Having separate cleanup functions for arena and tcache could result in
the tcache freeres function being called later and thus not deallocate
data for the thread arena. Avoid this by calling the tcache cleanup
function from within arena_thread_freeres."
Siddhesh
More information about the Libc-alpha
mailing list