GNU bug report logs - #45200
Wishlist: There should be a `malloc-trim' function

Previous Next

Package: emacs;

Reported by: Konstantin Kharlamov <hi-angel <at> yandex.ru>

Date: Sat, 12 Dec 2020 18:44:02 UTC

Severity: wishlist

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #86 received at 45200 <at> debbugs.gnu.org (full text, mbox):

From: DJ Delorie <dj <at> redhat.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: carlos <at> redhat.com, fweimer <at> redhat.com, monnier <at> iro.umontreal.ca,
 45200 <at> debbugs.gnu.org, Hi-Angel <at> yandex.ru
Subject: Re: bug#45200: [PATCH] Force Glibc to free the memory freed
Date: Tue, 26 Jan 2021 11:13:52 -0500
Eli Zaretskii <eliz <at> gnu.org> 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 ;-)





This bug report was last modified 3 years and 78 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.