add stats tracking to special large realloc paths

pull/121/head
Daniel Micay 2020-09-17 16:29:13 -04:00
parent 96a9bcf3a1
commit 85c5c3736c
1 changed files with 3 additions and 0 deletions

View File

@ -1394,6 +1394,7 @@ EXPORT void *h_realloc(void *old, size_t size) {
fatal_error("invalid realloc"); fatal_error("invalid realloc");
} }
region->size = size; region->size = size;
stats_large_deallocate(ra, old_size - size);
mutex_unlock(&ra->lock); mutex_unlock(&ra->lock);
thread_seal_metadata(); thread_seal_metadata();
@ -1416,6 +1417,7 @@ EXPORT void *h_realloc(void *old, size_t size) {
fatal_error("invalid realloc"); fatal_error("invalid realloc");
} }
region->size = size; region->size = size;
stats_large_allocate(ra, extra);
mutex_unlock(&ra->lock); mutex_unlock(&ra->lock);
thread_seal_metadata(); thread_seal_metadata();
@ -1438,6 +1440,7 @@ EXPORT void *h_realloc(void *old, size_t size) {
fatal_error("invalid realloc"); fatal_error("invalid realloc");
} }
regions_delete(region); regions_delete(region);
stats_large_deallocate(ra, old_size);
mutex_unlock(&ra->lock); mutex_unlock(&ra->lock);
if (memory_remap_fixed(old, old_size, new, size)) { if (memory_remap_fixed(old, old_size, new, size)) {