Bug 208 - mallinfo returns incomplete information
Summary: mallinfo returns incomplete information
Alias: None
Product: glibc
Classification: Unclassified
Component: malloc (show other bugs)
Version: 2.2.5
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2004-06-07 18:29 UTC by David Carlton
Modified: 2019-04-10 11:33 UTC (History)
5 users (show)

See Also:
Last reconfirmed: 2012-05-07 00:00:00
fweimer: security-


Note You need to log in before you can comment on or make changes to this bug.
Description David Carlton 2004-06-07 18:29:32 UTC
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.)
Comment 1 Petter Reinholdtsen 2004-08-08 09:15:21 UTC
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.
Comment 2 Ulrich Drepper 2004-09-26 13:44:59 UTC
mallinfo won't be extended.  We will have a new interface at some point.
Comment 3 Paul Pluzhnikov 2012-03-20 18:33:55 UTC
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.
Comment 4 Andreas Jaeger 2012-05-07 20:46:23 UTC
Removing target milestone: If somebody sends a patch, it can go in but we should not hold the 2.16 release for it.
Comment 5 Paul Pluzhnikov 2012-05-07 20:51:56 UTC
(In reply to comment #4)
> If somebody sends a patch

I sent a patch 9 month ago:
Comment 6 Andreas Jaeger 2012-05-07 21:16:12 UTC
Paul, it wasn't clear to me that your comment #3 linked to a patch. Could you resend it, please?
Comment 7 Paul Pluzhnikov 2012-05-15 16:52:03 UTC
Patch updated to git trunk and sent: