From 85c5c3736c396702ac5ce3aed7f18c0498c7334f Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Thu, 17 Sep 2020 16:29:13 -0400 Subject: [PATCH] add stats tracking to special large realloc paths --- h_malloc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/h_malloc.c b/h_malloc.c index 7e1306f..36831db 100644 --- a/h_malloc.c +++ b/h_malloc.c @@ -1394,6 +1394,7 @@ EXPORT void *h_realloc(void *old, size_t size) { fatal_error("invalid realloc"); } region->size = size; + stats_large_deallocate(ra, old_size - size); mutex_unlock(&ra->lock); thread_seal_metadata(); @@ -1416,6 +1417,7 @@ EXPORT void *h_realloc(void *old, size_t size) { fatal_error("invalid realloc"); } region->size = size; + stats_large_allocate(ra, extra); mutex_unlock(&ra->lock); thread_seal_metadata(); @@ -1438,6 +1440,7 @@ EXPORT void *h_realloc(void *old, size_t size) { fatal_error("invalid realloc"); } regions_delete(region); + stats_large_deallocate(ra, old_size); mutex_unlock(&ra->lock); if (memory_remap_fixed(old, old_size, new, size)) {