aboutsummaryrefslogtreecommitdiff
path: root/malloc
diff options
context:
space:
mode:
Diffstat (limited to 'malloc')
-rw-r--r--malloc/memusage.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/malloc/memusage.c b/malloc/memusage.c
index 19bb35f..b35444d 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];