[PATCH] Add mmapped count and size in malloc_info

Siddhesh Poyarekar siddhesh@redhat.com
Fri May 30 08:03:00 GMT 2014


Hi,

malloc_info currently only gives information about allocations on
heap, which is not complete without information about allocations that
were satisfied using mmap.  This trivial patch adds this information
as a new element to the xml.

This patch goes on top of Ondrej's patch to inline mi_arena.  OK to
commit?

Siddhesh

	* malloc/malloc (malloc_info): Also print mmapped statistics.

diff --git a/malloc/malloc.c b/malloc/malloc.c
index 963a333..9e98c6d 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -5148,12 +5148,14 @@ malloc_info (int options, FILE *fp)
   fprintf (fp,
            "<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
            "<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
+	   "<mmap nr=\"%zu\" size=\"%zu\"/>\n"
            "<system type=\"current\" size=\"%zu\"/>\n"
            "<system type=\"max\" size=\"%zu\"/>\n"
            "<aspace type=\"total\" size=\"%zu\"/>\n"
            "<aspace type=\"mprotect\" size=\"%zu\"/>\n"
            "</malloc>\n",
            total_nfastblocks, total_fastavail, total_nblocks, total_avail,
+	   mp_.n_mmaps, mp_.mmapped_mem,
            total_system, total_max_system,
            total_aspace, total_aspace_mprotect);
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20140530/a32cda07/attachment.sig>


More information about the Libc-alpha mailing list