Judging from both the implementation and an experiment, mallinfo()
only returns information about the memory used in the current arena.
This doesn't seem to be mentioned anywhere in the info file or
in malloc.h, and I don't see how it's useful information, given that
arenas don't seem to be exposed in the user interface.
I am aware of malloc_stats(), but I don't always want the statistics
dumped to stderr. (Incidentally, malloc_stats() doesn't seem to be
mentioned in the info pages.)
The mallinfo() API was discussed on libc-alpha recently, and the
conclusion was that the info provided do not really match the
current implementation. It apparently was part of SysV, but has
been dropped from later version of the unix standard. It should
probably be removed and replaced with a better API. The current API
do not handle large amount of memory and isn't working very well
in 64bit environments.
mallinfo won't be extended. We will have a new interface at some point.
8 years later, mallinfo() still actively lies to 32-bit applications, and no new interface has emerged ;-(
Re-opening in hope that this PR can be re-considered.
FWIW, the use case I have is a 32-bit java/JNI application, that wants to use mallinfo() for out-of-memory self-diagnostics.
Removing target milestone: If somebody sends a patch, it can go in but we should not hold the 2.16 release for it.
(In reply to comment #4)
> If somebody sends a patch
I sent a patch 9 month ago:
Paul, it wasn't clear to me that your comment #3 linked to a patch. Could you resend it, please?
Patch updated to git trunk and sent: