diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-12-20 10:54:20 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-12-20 11:04:28 +0100 |
| commit | 41b31dc58d035e20b00fbc62977ec67277f2ef34 (patch) | |
| tree | 7cc256651bee6de73f5822ca103d091a9f201cd0 /src | |
| parent | f8b9c7b2b7760ac9551927fac31bcbf2ba1673d1 (diff) | |
| download | box64-41b31dc58d035e20b00fbc62977ec67277f2ef34.tar.gz box64-41b31dc58d035e20b00fbc62977ec67277f2ef34.zip | |
[BOX32] use malloc_trim when it gives non 32bits pointers
Diffstat (limited to 'src')
| -rw-r--r-- | src/mallochook.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mallochook.c b/src/mallochook.c index 474972ee..ebd7a017 100644 --- a/src/mallochook.c +++ b/src/mallochook.c @@ -6,6 +6,7 @@ #include <sys/param.h> #include <sys/mman.h> #include <dlfcn.h> +#include <malloc.h> #include "box64context.h" #include "debug.h" @@ -190,6 +191,7 @@ void* box32_calloc(size_t n, size_t s) void* ret = box_calloc(n, s); if(ret<SPACE32) return ret; box_free(ret); + malloc_trim(0); return customCalloc32(n, s); } void* box32_malloc(size_t s) @@ -197,6 +199,7 @@ void* box32_malloc(size_t s) void* ret = box_malloc(s); if(ret<SPACE32) return ret; box_free(ret); + malloc_trim(0); return customMalloc32(s); } void* box32_realloc(void* p, size_t s) @@ -205,6 +208,7 @@ void* box32_realloc(void* p, size_t s) return customRealloc32(p, s); void* ret = box_realloc(p, s); if(ret<SPACE32) return ret; + malloc_trim(0); void* newret = customMalloc32(s); memcpy(newret, ret, s); box_free(ret); @@ -222,6 +226,7 @@ void* box32_memalign(size_t align, size_t s) void* ret = box_memalign(align, s); if(ret<SPACE32) return ret; box_free(ret); + malloc_trim(0); return customMemAligned32(align, s); } size_t box32_malloc_usable_size(void* p) |