]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Base max_fast on alignment, not width, of bins (Bug 24903)
authorDJ Delorie <dj@redhat.com>
Wed, 30 Oct 2019 22:03:14 +0000 (18:03 -0400)
committerDJ Delorie <dj@redhat.com>
Thu, 31 Oct 2019 02:59:11 +0000 (22:59 -0400)
set_max_fast sets the "impossibly small" value based on,
eventually, MALLOC_ALIGNMENT.  The comparisons for the smallest
chunk used is, eventually, MIN_CHUNK_SIZE.  Note that i386
is the only platform where these are the same, so a smallest
chunk *would* be put in a no-fastbins fastbin.

This change calculates the "impossibly small" value
based on MIN_CHUNK_SIZE instead, so that we can know it will
always be impossibly small.

malloc/malloc.c

index 5d3e82a8f6e2521362e9881885f453b4cc341823..70cc35a47332af49ad86dd097658c9040c7b4237 100644 (file)
@@ -1621,7 +1621,7 @@ static INTERNAL_SIZE_T global_max_fast;
 
 #define set_max_fast(s) \
   global_max_fast = (((s) == 0)                                                      \
-                     ? SMALLBIN_WIDTH : ((s + SIZE_SZ) & ~MALLOC_ALIGN_MASK))
+                     ? MIN_CHUNK_SIZE / 2 : ((s + SIZE_SZ) & ~MALLOC_ALIGN_MASK))
 
 static inline INTERNAL_SIZE_T
 get_max_fast (void)