From d3acfb610f210bcc8998096c7d11138767e3499a Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 20 Sep 2001 19:36:46 +0000 Subject: Update. * malloc/memusage.c (realloc): Don't count already allocated memory in the sums. (me): Always use dlsym() to find the real implementations. --- malloc/memusage.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'malloc/memusage.c') 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]; -- cgit v1.2.3