CS::Memory::LocalBufferAllocator< T, N, ExcessAllocator, SingleAllocation > Class Template Reference
An allocator with a small local buffer. More...
template<typename T, size_t N, class ExcessAllocator = AllocatorMalloc, bool SingleAllocation = false>
class CS::Memory::LocalBufferAllocator< T, N, ExcessAllocator, SingleAllocation >
An allocator with a small local buffer.
If the data fits into the local buffer (which is set up to holds
N elements of type
T), a memory allocation from the heap is saved. Thus, if you have lots of arrays with a relatively small, well known size you can gain some performance by using this allocator.
SingleAllocation specifies whether no more than a single block is allocated from the allocator at any time. Using that option saves (albeit a miniscule amount of) memory, but obviously is only safe when it's known that the single allocation constraint is satisfied (such as allocators for csArray<>s).
- The pointer returned may point into the instance data; be careful when moving that around - an earlier allocated pointer may suddenly become invalid!
- This means that if you use this allocator with an array, and you nest that into another array, you MUST use csSafeCopyArrayElementHandler for the nesting array!
The documentation for this class was generated from the following file:
Generated for Crystal Space 2.0 by doxygen 1.6.1