diff --git a/src/fast_allocator.c b/src/fast_allocator.c index 23941eb..51a8f46 100644 --- a/src/fast_allocator.c +++ b/src/fast_allocator.c @@ -167,6 +167,15 @@ static int region_init(struct fast_allocator_context *acontext, return result; } + if (region->count == 1) { + if (region->start == 0) { + region->step += sizeof(struct allocator_wrapper); + } else { + region->start += sizeof(struct allocator_wrapper); + } + region->end += sizeof(struct allocator_wrapper); + } + name = name_buff; result = 0; allocator = region->allocators; diff --git a/src/tests/test_sorted_array.c b/src/tests/test_sorted_array.c index 918f993..577de44 100644 --- a/src/tests/test_sorted_array.c +++ b/src/tests/test_sorted_array.c @@ -26,7 +26,7 @@ #include "fastcommon/array_allocator.h" #include "fastcommon/sorted_array.h" -#define ELEMENT_COUNT 5 * 1000 +#define ELEMENT_COUNT 1000 static bool silence;