diff --git a/include/sonic/allocator.h b/include/sonic/allocator.h index 2c28ce2..52958ac 100644 --- a/include/sonic/allocator.h +++ b/include/sonic/allocator.h @@ -255,7 +255,7 @@ class MemoryPoolAllocator { size_t chunkSize = SONIC_ALLOCATOR_MIN_CHUNK_CAPACITY, BaseAllocator* baseAllocator = 0) : cp_(chunkSize), - baseAllocator_(baseAllocator), + baseAllocator_(baseAllocator ? baseAllocator : new BaseAllocator()), shared_(static_cast(AlignBuffer(buffer, size))) { sonic_assert(size >= SIZEOF_SHARED_DATA + SIZEOF_CHUNK_HEADER); shared_->chunkHead = GetChunkHead(shared_);