diff options
Diffstat (limited to 'src/malloc')
-rw-r--r-- | src/malloc/free.c | 2 | ||||
-rw-r--r-- | src/malloc/mallocng/free.c | 2 | ||||
-rw-r--r-- | src/malloc/mallocng/glue.h | 2 |
3 files changed, 4 insertions, 2 deletions
diff --git a/src/malloc/free.c b/src/malloc/free.c index f17a952c..3944f7b2 100644 --- a/src/malloc/free.c +++ b/src/malloc/free.c @@ -2,5 +2,5 @@ void free(void *p) { - return __libc_free(p); + __libc_free(p); } diff --git a/src/malloc/mallocng/free.c b/src/malloc/mallocng/free.c index 418a085c..43f32aad 100644 --- a/src/malloc/mallocng/free.c +++ b/src/malloc/mallocng/free.c @@ -119,7 +119,7 @@ void free(void *p) if (((uintptr_t)(start-1) ^ (uintptr_t)end) >= 2*PGSZ && g->last_idx) { unsigned char *base = start + (-(uintptr_t)start & (PGSZ-1)); size_t len = (end-base) & -PGSZ; - if (len) { + if (len && USE_MADV_FREE) { int e = errno; madvise(base, len, MADV_FREE); errno = e; diff --git a/src/malloc/mallocng/glue.h b/src/malloc/mallocng/glue.h index 151c48b8..77f4c812 100644 --- a/src/malloc/mallocng/glue.h +++ b/src/malloc/mallocng/glue.h @@ -24,6 +24,8 @@ #define realloc __libc_realloc #define free __libc_free +#define USE_MADV_FREE 0 + #if USE_REAL_ASSERT #include <assert.h> #else |