Subject: bug#45200: [PATCH] Force Glibc to free the memory freed

From: DJ Delorie <[email-masked]>
Date: Tue, 26 Jan 2021 11:13:52 -0500

Eli Zaretskii <[email-masked]> writes:
>> malloc_trim() is very expensive relative to free(), partly because of
>> what it needs to do, and partly because it flushes the fastbins cache.
>
> How expensive?  Can you give some quantitative measure?

malloc_trim() is to free() as garbage collection is to just dropping a
reference.

>> If you call it every, say, 1000 iterations of free, that might suffice.
>> Or perhaps after each GC run.
>
> There's no guarantee that a full GC will call 'free', even though
> that's quite likely.

malloc_trim() is our garbage collector, if you call it after GC that
would be "appropriate" at least ;-)