This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch, master, updated. glibc-2.11-130-g346bc35


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  346bc35c33fa08e23d7774d374b0e2586ca5dab6 (commit)
      from  52e2ea9a83ba3c6ea3b39f0f138af4343c9d687c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=346bc35c33fa08e23d7774d374b0e2586ca5dab6

commit 346bc35c33fa08e23d7774d374b0e2586ca5dab6
Author: Ulrich Drepper <drepper@redhat.com>
Date:   Thu Jan 14 13:32:58 2010 -0800

    Fix malloc_info without prioor allocations.

diff --git a/ChangeLog b/ChangeLog
index 3cf70a9..db85d0c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2010-01-14  Ulrich Drepper  <drepper@redhat.com>
 
+	[BZ #11126]
+	* malloc/malloc.c (malloc_info): Initialize malloc if not already
+	done.  Handle empty bin lists.
+
 	* posix/unistd.h: Change getpagesize and getdtablesize declaration
 	visibility some more.
 
diff --git a/malloc/malloc.c b/malloc/malloc.c
index ea10d17..b43e454 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -6369,16 +6369,19 @@ malloc_info (int options, FILE *fp)
 
     mbinptr bin = bin_at (ar_ptr, 1);
     struct malloc_chunk *r = bin->fd;
-    while (r != bin)
+    if (r != NULL)
       {
-	++sizes[NFASTBINS].count;
-	sizes[NFASTBINS].total += r->size;
-	sizes[NFASTBINS].from = MIN (sizes[NFASTBINS].from, r->size);
-	sizes[NFASTBINS].to = MAX (sizes[NFASTBINS].to, r->size);
-	r = r->fd;
+	while (r != bin)
+	  {
+	    ++sizes[NFASTBINS].count;
+	    sizes[NFASTBINS].total += r->size;
+	    sizes[NFASTBINS].from = MIN (sizes[NFASTBINS].from, r->size);
+	    sizes[NFASTBINS].to = MAX (sizes[NFASTBINS].to, r->size);
+	    r = r->fd;
+	  }
+	nblocks += sizes[NFASTBINS].count;
+	avail += sizes[NFASTBINS].total;
       }
-    nblocks += sizes[NFASTBINS].count;
-    avail += sizes[NFASTBINS].total;
 
     for (size_t i = 2; i < NBINS; ++i)
       {
@@ -6388,17 +6391,18 @@ malloc_info (int options, FILE *fp)
 	sizes[NFASTBINS - 1 + i].to = sizes[NFASTBINS - 1 + i].total
 	  = sizes[NFASTBINS - 1 + i].count = 0;
 
-	while (r != bin)
-	  {
-	    ++sizes[NFASTBINS - 1 + i].count;
-	    sizes[NFASTBINS - 1 + i].total += r->size;
-	    sizes[NFASTBINS - 1 + i].from = MIN (sizes[NFASTBINS - 1 + i].from,
+	if (r != NULL)
+	  while (r != bin)
+	    {
+	      ++sizes[NFASTBINS - 1 + i].count;
+	      sizes[NFASTBINS - 1 + i].total += r->size;
+	      sizes[NFASTBINS - 1 + i].from
+		= MIN (sizes[NFASTBINS - 1 + i].from, r->size);
+	      sizes[NFASTBINS - 1 + i].to = MAX (sizes[NFASTBINS - 1 + i].to,
 						 r->size);
-	    sizes[NFASTBINS - 1 + i].to = MAX (sizes[NFASTBINS - 1 + i].to,
-					       r->size);
 
-	    r = r->fd;
-	  }
+	      r = r->fd;
+	    }
 
 	if (sizes[NFASTBINS - 1 + i].count == 0)
 	  sizes[NFASTBINS - 1 + i].from = 0;
@@ -6460,6 +6464,9 @@ malloc_info (int options, FILE *fp)
     fputs ("</heap>\n", fp);
   }
 
+  if(__malloc_initialized < 0)
+    ptmalloc_init ();
+
   fputs ("<malloc version=\"1\">\n", fp);
 
   /* Iterate over all arenas currently in use.  */

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog       |    4 ++++
 malloc/malloc.c |   41 ++++++++++++++++++++++++-----------------
 2 files changed, 28 insertions(+), 17 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]