Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

cache_chunklist Class

Defines a block allocator that allocates and deallocates memory blocks of a single size.

template <std::size_t Sz, std::size_t Nelts = 20> class cache_chunklist




The number of elements in the array to be allocated.

This template class uses operator new to allocate chunks of raw memory, suballocating blocks to allocate storage for a memory block when needed; it stores deallocated memory blocks in a separate free list for each chunk, and uses operator delete to deallocate a chunk when none of its memory blocks is in use.

Each memory block holds Sz bytes of usable memory and a pointer to the chunk that it belongs to. Each chunk holds Nelts memory blocks, three pointers, an int and the data that operator new and operator delete require.


Constructs an object of type cache_chunklist.


Allocates a block of memory.


Frees a specified number of objects from storage beginning at a specified position.

Header: <allocators>

Namespace: stdext

© 2015 Microsoft