mirror of
git://sourceware.org/git/glibc.git
synced 2024-11-21 01:12:26 +08:00
* malloc/malloc.c: Use all small bin slots on 64-bit archs.
* malloc/malloc.c (largebin_index): Really have 32 buckets with 64 sizes.
This commit is contained in:
parent
1a31b586c4
commit
1d47e92f71
@ -1,6 +1,9 @@
|
||||
2007-05-14 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* malloc/malloc.c (largebin_index): Really have 32 buckets with 64 sizes.
|
||||
* malloc/malloc.c: Use all small bin slots on 64-bit archs.
|
||||
|
||||
* malloc/malloc.c (largebin_index): Really have 32 buckets with 64
|
||||
sizes.
|
||||
|
||||
2007-05-13 Ulrich Drepper <drepper@redhat.com>
|
||||
* malloc/malloc.c [MALLOC_DEBUG]: Keep track of current maximum
|
||||
|
@ -2125,15 +2125,16 @@ typedef struct malloc_chunk* mbinptr;
|
||||
|
||||
#define NBINS 128
|
||||
#define NSMALLBINS 64
|
||||
#define SMALLBIN_WIDTH 8
|
||||
#define MIN_LARGE_SIZE 512
|
||||
#define SMALLBIN_WIDTH MALLOC_ALIGNMENT
|
||||
#define MIN_LARGE_SIZE (NSMALLBINS * SMALLBIN_WIDTH)
|
||||
|
||||
#define in_smallbin_range(sz) \
|
||||
((unsigned long)(sz) < (unsigned long)MIN_LARGE_SIZE)
|
||||
|
||||
#define smallbin_index(sz) (((unsigned)(sz)) >> 3)
|
||||
#define smallbin_index(sz) \
|
||||
(SMALLBIN_WIDTH == 16 ? (((unsigned)(sz)) >> 4) : (((unsigned)(sz)) >> 3))
|
||||
|
||||
#define largebin_index(sz) \
|
||||
#define largebin_index_32(sz) \
|
||||
(((((unsigned long)(sz)) >> 6) <= 38)? 56 + (((unsigned long)(sz)) >> 6): \
|
||||
((((unsigned long)(sz)) >> 9) <= 20)? 91 + (((unsigned long)(sz)) >> 9): \
|
||||
((((unsigned long)(sz)) >> 12) <= 10)? 110 + (((unsigned long)(sz)) >> 12): \
|
||||
@ -2141,6 +2142,20 @@ typedef struct malloc_chunk* mbinptr;
|
||||
((((unsigned long)(sz)) >> 18) <= 2)? 124 + (((unsigned long)(sz)) >> 18): \
|
||||
126)
|
||||
|
||||
// XXX It remains to be seen whether it is good to keep the widths of
|
||||
// XXX the buckets the same or whether it should be scaled by a factor
|
||||
// XXX of two as well.
|
||||
#define largebin_index_64(sz) \
|
||||
(((((unsigned long)(sz)) >> 6) <= 48)? 48 + (((unsigned long)(sz)) >> 6): \
|
||||
((((unsigned long)(sz)) >> 9) <= 20)? 91 + (((unsigned long)(sz)) >> 9): \
|
||||
((((unsigned long)(sz)) >> 12) <= 10)? 110 + (((unsigned long)(sz)) >> 12): \
|
||||
((((unsigned long)(sz)) >> 15) <= 4)? 119 + (((unsigned long)(sz)) >> 15): \
|
||||
((((unsigned long)(sz)) >> 18) <= 2)? 124 + (((unsigned long)(sz)) >> 18): \
|
||||
126)
|
||||
|
||||
#define largebin_index(sz) \
|
||||
(SIZE_SZ == 8 ? largebin_index_64 (sz) : largebin_index_32 (sz))
|
||||
|
||||
#define bin_index(sz) \
|
||||
((in_smallbin_range(sz)) ? smallbin_index(sz) : largebin_index(sz))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user