[PATCH] malloc: Remove dumped heap support

Sam James sam@gentoo.org
Tue Jul 29 21:45:09 GMT 2025


Wilco Dijkstra <Wilco.Dijkstra@arm.com> writes:

> Remove support for obsolete dumped heaps.  Dumping heaps was discontinued
> 8 years ago, however loading a dumped heap is still supported. This blocks
> changes and improvements of the malloc data structures - hence it is time
> to remove this.  Ancient binaries that still call malloc_set_state will now
> get the -1 error code.  Update tst-mallocstate.c to just check for this.

I had some questions when reading over this -- I think I've answered
them myself, but I'm writing them here in case it's useful to others, or
in case I'm wrong ;)

Depending on that, I think some reference to the previous discussions
and the limited impact on even old Emacs accordingly would be useful in
the commit message.

--

Reading the old thread [0] on the original changes which landed here, I see:
> malloc_get_state is only used during the Emacs build process,
> so we provide a stub implementation only.  Existing Emacs binaries
> will not call this stub function, but still reference the symbol.

This reassured me, but I was concerned seeing the changes below because
of "... contained in historic Emacs executables". My modern Emacs built
from trunk does have a .pdmp file installed at least. I don't know if
old Emacs ever installed its (non-portable) dump, or if it was ever
actually used for anything once installed.

The NEWS item in the old thread however says:
> +  Any undumped
> +  Emacs executables, which normally exist only during an Emacs build, should
> +  be rebuilt by re-running ./configure; make in the Emacs build tree.

... so if that's right and it really is only about build directories
(because an old Emacs would either never install a non-portable dump, or
has no reason to ever use it), then we're fine.

[0] https://inbox.sourceware.org/libc-alpha/4e918c27-a9bc-e7d5-7443-62df02746566@redhat.com/

>
> Passes regress, OK for commit?
>
> ---
>
> diff --git a/malloc/malloc-debug.c b/malloc/malloc-debug.c
> index 8bcb5652e0d40cab49120dd8b98f4657bcd01f82..0bb57841eebb74cb8097577b2577f18d1be6442a 100644
> --- a/malloc/malloc-debug.c
> +++ b/malloc/malloc-debug.c

> [...]

> -/* Dummy implementation which always fails.  We need to provide this
> -   symbol so that existing Emacs binaries continue to work with
> -   BIND_NOW.  */
> +/* Support for saving/restoring dumped heaps in old GLIBCs is no
> +   longer implemented - instead we provide dummy implementations
> +   which always fail.  We need to provide these symbol so that
> +   existing Emacs binaries continue to work with BIND_NOW.  */

(This is the comment I was worried had become stale/needed further
tweaks, given the "existing Emacs binaries").

>  void *
>  malloc_get_state (void)
>  {
> @@ -566,81 +489,7 @@ compat_symbol (libc_malloc_debug, malloc_get_state, malloc_get_state,
>  int
>  malloc_set_state (void *msptr)
>  {

> [...]

thanks,
sam


More information about the Libc-alpha mailing list