#1054487 manpages-dev: mcheck(3), mtrace(3): LD_PRELOAD=libc_malloc_debug.so is needed

Package:
manpages-dev
Source:
manpages-dev
Submitter:
Vincent Lefevre
Date:
2026-01-10 10:59:31 UTC
Severity:
normal
Tags:
#1054487#5
Date:
2023-10-24 12:07:10 UTC
From:
To:
Even when MALLOC_TRACE is set, mtrace() doesn't produce any result.

I've tested the example given in the mtrace(3) man page, and the
/tmp/t file is not created.

#1054487#10
Date:
2023-10-24 13:17:02 UTC
From:
To:
Control: retitle -1 libc6: mtrace doesn't produce any result
Control: found -1 2.36-9+deb12u3

Same issue on cfarm29.cfarm.net (ppc64le, Debian 12.2).

The example works fine on Debian 11.

#1054487#19
Date:
2023-10-24 13:55:31 UTC
From:
To:
I can also reproduce the issue on a Red Hat machine with glibc 2.34,
but this is actually an error in the man page: one now needs to
preload the libc_malloc_debug.so library.

/usr/share/doc/libc6/NEWS.gz says for 2.34:

* Debugging features in malloc such as the MALLOC_CHECK_ environment variable
  (or the glibc.malloc.check tunable), mtrace() and mcheck() have now been
  disabled by default in the main C library.  Users looking to use these
  features now need to preload a new debugging DSO libc_malloc_debug.so to get
  this functionality back.

So in the example in the mtrace(3) man page

           $ cc -g t_mtrace.c -o t_mtrace
           $ export MALLOC_TRACE=/tmp/t
           $ ./t_mtrace
           $ mtrace ./t_mtrace $MALLOC_TRACE

the 3rd command should be changed to

           $ LD_PRELOAD=libc_malloc_debug.so ./t_mtrace

#1054487#34
Date:
2023-10-24 14:55:48 UTC
From:
To:
There's the same issue in the mcheck(3) man page. I've submitted
a patch upstream.

Ideally, the DESCRIPTION section should also mention the need of
preloading libc_malloc_debug.so...

BTW, I've just noticed that the mallopt(3) man page may need to be
updated too (I've not tested yet).

#1054487#43
Date:
2026-01-10 10:10:29 UTC
From:
To:
Es gibt eine Familienspende in Höhe von 1.850.000,00 USD von Cheng Charlie
Saephan. Bitte antworten Sie für weitere Informationen. Denken Sie daran,
Ihrer Familie und den Bedürftigen in Ihrer Umgebung Gutes zu tun.

Dies ist bereits der zweite Versuch, Sie zu erreichen. Bitte antworten Sie
für weitere Details.

#1054487#48
Date:
2026-01-10 10:10:29 UTC
From:
To:
Es gibt eine Familienspende in Höhe von 1.850.000,00 USD von Cheng Charlie
Saephan. Bitte antworten Sie für weitere Informationen. Denken Sie daran,
Ihrer Familie und den Bedürftigen in Ihrer Umgebung Gutes zu tun.

Dies ist bereits der zweite Versuch, Sie zu erreichen. Bitte antworten Sie
für weitere Details.