I couldn't found standard that may explain chunks be allocated together must be deallocate together.
But' loki-allocator for STL just use count*size(T) for new memory block size.
Is it right?
Please answer me…
The allocate and deallocate functions in LokiAllocator must allow for arrays.
// Make an array of 10 Things.
Thing * myThings = new Thing;
// Now deallocate the array.
Section 5.3.4 and Section 5.3.5 of the C++ Standard describe array allocation and deallocation.
Line 5 in Section 22.214.171.124 allocator members explicitly says to multiply the count by the sizeof the type to determine how much memory to allocate for arrays. Line 8 says the count for deallocate should be the same value as that passed into allocate. This means the C++ Standard wants to make sure arrays of objects are allocated and deallocated together.
I hope that answers your question. If not, could you please clarify what you meant?
Thank you very much for your help.
You are so kind.