C/C++ Reference
AllocatorIntf Struct Reference

Memory allocation and deallocation Interface class. More...

#include <HttpServerLib.h>

Inheritance diagram for AllocatorIntf:
Collaboration diagram for AllocatorIntf:

List of all members.

Public Member Functions

 AllocatorIntf (AllocatorIntf_Malloc malloc, AllocatorIntf_Realloc realloc, AllocatorIntf_Free free)
 Create an instance of a memory allocation class.
void * malloc (size_t *size)
 Returns pointer to uninitialized newly-allocated space for an object of size "size", or NULL on error.
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.
void free (void *p)
 Deallocates space to which it points.

Static Public Member Functions

static AllocatorIntfgetDefault (void)
 Returns a pointer to a predefined AllocatorIntf class.

Detailed Description

Memory allocation and deallocation Interface class.

This abstract interface class is used by some of the Barracuda classes when allocating memory. The reason for using an interface class and not directly calling the global functions baMalloc(), baRealloc() and baFree() is to provide a finer control of allocated memory. For example, an implementation of the AllocatorIntf can work with blocks of memory allocated from static memory. Implementing realloc is optional and can be set to NULL if not implemented.