ion-c
ion-c copied to clipboard
Add Sentinel for Pool Allocator Not Initialized
As part of fixing #180, there was a line of code that appears to be a bug:
https://github.com/amzn/ion-c/blob/a9af6be3f2ed38d4775257adfa5672c845cac361/ionc/ion_allocation.c#L39-L54
Specifically, g_ion_alloc_page_list.page_size == ION_ALLOC_PAGE_POOL_PAGE_SIZE_NONE should not be used as a sentinel for page pool requires initialization, because it is currently used to mean don't use page pool. As a result the library today always uses the page pool.
We should create the right sentinel for this (probably make it per-thread configurable, since the pool is now thread-local), and also find other usages of ion_initialize_page_pool that might be doing the same.