XLE
v0.02.0
|
And STL allocator that will suppress deallocation when memory comes from a part of a larger heap block More...
#include <Serialization.h>
Classes | |
struct | rebind |
Public Member Functions | |
pointer | allocate (size_type n, std::allocator< void >::const_pointer ptr=0) |
void | deallocate (pointer p, size_type n) |
BlockSerializerAllocator (unsigned fromFixedStorage) | |
BlockSerializerAllocator (const std::allocator< Type > ©From) | |
BlockSerializerAllocator (std::allocator< Type > &&moveFrom) | |
BlockSerializerAllocator (const BlockSerializerAllocator< Type > ©From) | |
BlockSerializerAllocator (BlockSerializerAllocator< Type > &&moveFrom) | |
And STL allocator that will suppress deallocation when memory comes from a part of a larger heap block
When we serialize an object in via the block serializer, we can loading it into a single heap block. However, objects loaded new can have STL containers and objects (like vectors and strings). In this case, the memory used by the container is a just a part of the larger heap block. When the container is destroyed, it will attempt to free it's memory. In the of a normal container, the memory is it's own unique heap block, and the normal deallocation functions can be used. But for our serialized containers, the memory is not a unique heap block. It is just a internal part of much larger block. In this case, we must suppress the deallocation. The BlockSerializerAllocator does exactly that. For vectors and containers that have been serialized in, we suppress the deallocation step.