Detailed Description

This class implements a memory allocator which can efficiently allocate objects that all have the same size.

It has no memory overhead per allocation (unless the objects are smaller than sizeof(void*) bytes) and is extremely fast, both for Alloc() and Free(). The only restriction is that any specific allocator can be used for just one type of object (the type for which the template is instantiated).

Remarks:

Defining the macro CS_FIXEDSIZEALLOC_DEBUG will cause freed objects to be overwritten with '0xfb' bytes. This can be useful to track use of already freed objects, as they can be more easily recognized (as some members will be likely bogus.)

Bigger values for nelem will improve allocation performance, but at the cost of having some potential waste if you do not add nelem elements to each pool. For instance, if nelem is 50 but you only add 3 elements to the pool, then the space for the remaining 47 elements, though allocated, will remain unused (until you add more elements).

Bigger values for nelem will improve allocation performance, but at the cost of having some potential waste if you do not add nelem elements to each pool. For instance, if nelem is 50 but you only add 3 elements to the pool, then the space for the remaining 47 elements, though allocated, will remain unused (until you add more elements).