Table 14-2 summarizes the methods of available through the MemAllocator interface.
Table 14-2 Summary of MemAllocator Methods; Ctx Package
| Function | Summary |
|---|---|
| alloc
|
Allocates memory of given size. |
| dealloc
|
Deallocate memory pointed to by the argument. |
| ~MemAllocator
|
Virtual destructor - interface level handle to actual destructors. |
This is a virtual member function that defines a prototype for user defined allocator functions
virtual void* alloc( ub4 size) = 0;
| Parameter | Description |
|---|---|
size |
memory size |
This is a virtual member function that defines a prototype for user defined deallocator functions. Such deallocators are supposed to deallocate memory allocated by the alloc member functions
virtual void dealloc( void* ptr) = 0;
| Parameter | Description |
|---|---|
ptr |
pointer to previously allocated memory |
It provides an interface level handle to actual destructors that can be invoked without knowing their names or implementations
virtual ~MemAllocator() {}