Skip to content

Commit c5ec9bb

Browse files
committed
Add more alloc classes to global base_alloc
1 parent c4edf35 commit c5ec9bb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/base_alloc/base_alloc_global.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ static UTIL_ONCE_FLAG ba_is_initialized = UTIL_ONCE_FLAG_INIT;
2323

2424
// allocation classes need to be consecutive powers of 2
2525
#define ALLOCATION_CLASSES \
26-
{ 16, 32, 64, 128 }
27-
#define NUM_ALLOCATION_CLASSES 4
26+
{ 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192 }
27+
#define NUM_ALLOCATION_CLASSES 10
2828

2929
struct base_alloc_t {
3030
size_t ac_sizes[NUM_ALLOCATION_CLASSES];
@@ -137,8 +137,9 @@ void *umf_ba_global_aligned_alloc(size_t size, size_t alignment) {
137137
if (size > BASE_ALLOC.ac_sizes[NUM_ALLOCATION_CLASSES - 1]) {
138138
#ifndef NDEBUG
139139
fprintf(stderr,
140-
"base_alloc: allocation size larger than the biggest "
141-
"allocation class. Falling back to OS memory allocation.\n");
140+
"base_alloc: allocation size (%zu) larger than the biggest "
141+
"allocation class. Falling back to OS memory allocation.\n",
142+
size);
142143
#endif
143144
return transform_ptr(ba_os_alloc(size), size, alignment);
144145
}

0 commit comments

Comments
 (0)