|
Barracuda Application Server C/C++ Reference
NO
|
This is a fixed size allocator implementation for the abstract interface class AllocatorIntf.
The FixedSizeAllocator takes a buffer and splits the buffer up into equally sized chunks. Allocating memory larger than the chunk size or using realloc results in an error; i.e., NULL returned. One can allocate a smaller size than the chunk size, but the size will be adjusted to the chunk size.
#include <FixedSizeAllocator.h>

Public Member Functions | |
| FixedSizeAllocator (void *buffer, size_t bufSize, size_t blockSize) | |
| Create a fixed size allocator. More... | |
Public Member Functions inherited from AllocatorIntf | |
| AllocatorIntf (AllocatorIntf_Malloc malloc, AllocatorIntf_Realloc realloc, AllocatorIntf_Free free) | |
| Create an instance of a memory allocation class. More... | |
| void * | malloc (size_t *size) |
| Returns pointer to uninitialized newly-allocated space for an object of size "size", or NULL on error. More... | |
| void * | realloc (void *p, size_t *size) |
| Returns pointer to newly-allocated space for an object of size "size", initialized, to minimum of old and new sizes, to existing contents of p (if non-null), or NULL on error. More... | |
| void | free (void *p) |
| Deallocates space to which it points. | |
Additional Inherited Members | |
Static Public Member Functions inherited from AllocatorIntf | |
| static AllocatorIntf * | getDefault (void) |
| Returns a pointer to a predefined AllocatorIntf class. More... | |
| FixedSizeAllocator::FixedSizeAllocator | ( | void * | buffer, |
| size_t | bufSize, | ||
| size_t | blockSize | ||
| ) |
Create a fixed size allocator.
| buffer | a pointer to the memory location for the fixed size allocator. |
| bufSize | the size of the buffer. The size should be n*blockSize. |
| blockSize | the size of the chunks. |