From 3f808958223084b246d656019bff9ca11c8a9612 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Thu, 30 Aug 2018 09:29:15 -0400 Subject: [PATCH] ignore pad argument to malloc_trim per glibc The pad argument is only used by the main arena for sbrk in glibc, with every other page size gap purged with MADV_DONTNEED. It makes more sense to simply treat it as an ignored legacy parameter rather than trying to come up with a sensible way to use it for keeping cached free slabs. --- malloc.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/malloc.c b/malloc.c index 2a1a275..a68a18d 100644 --- a/malloc.c +++ b/malloc.c @@ -981,13 +981,7 @@ EXPORT int h_mallopt(UNUSED int param, UNUSED int value) { return 0; } -static const size_t pad_threshold = max_empty_slabs_total * N_SIZE_CLASSES; - -EXPORT int h_malloc_trim(size_t pad) { - if (pad > pad_threshold) { - return 0; - } - +EXPORT int h_malloc_trim(UNUSED size_t pad) { if (!is_init()) { return 0; }