about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-09-20 19:36:46 +0000
committerUlrich Drepper <drepper@redhat.com>2001-09-20 19:36:46 +0000
commitd3acfb610f210bcc8998096c7d11138767e3499a (patch)
tree7cd34d7260dea3e5abae017ff0c5a240d491232f
parent0e21f7767e2746d212cfc0ae117db2d035beed18 (diff)
downloadglibc-d3acfb610f210bcc8998096c7d11138767e3499a.tar.gz
glibc-d3acfb610f210bcc8998096c7d11138767e3499a.tar.xz
glibc-d3acfb610f210bcc8998096c7d11138767e3499a.zip
Update.
	* malloc/memusage.c (realloc): Don't count already allocated
	memory in the sums.
	(me): Always use dlsym() to find the real implementations.
-rw-r--r--ChangeLog5
-rw-r--r--malloc/memusage.c11
2 files changed, 10 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 0e1dcfe9b6..ada11dd940 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,8 @@
 2001-09-20  Ulrich Drepper  <drepper@redhat.com>
 
-	* malloc/memusage.c (me): Always use dlsym() to find the real
-	implementations.
+	* malloc/memusage.c (realloc): Don't count already allocated
+	memory in the sums.
+	(me): Always use dlsym() to find the real implementations.
 
 	* malloc/memusage.sh: Make -n option actually do something.
 
diff --git a/malloc/memusage.c b/malloc/memusage.c
index 19bb35f94f..b35444da10 100644
--- a/malloc/memusage.c
+++ b/malloc/memusage.c
@@ -357,10 +357,13 @@ realloc (void *old, size_t len)
 
   /* Keep track of number of calls.  */
   ++calls[idx_realloc];
-  /* Keep track of total memory consumption for `realloc'.  */
-  total[idx_realloc] += len;
-  /* Keep track of total memory requirement.  */
-  grand_total += len;
+  if (len > old_len)
+    {
+      /* Keep track of total memory consumption for `realloc'.  */
+      total[idx_realloc] += len - old_len;
+      /* Keep track of total memory requirement.  */
+      grand_total += len - old_len;
+    }
   /* Remember the size of the request.  */
   if (len < 65536)
     ++histogram[len / 16];