Go to the source code of this file.
Data Structures | |
struct | PaUtilAllocationGroup |
Functions | |
PaUtilAllocationGroup * | PaUtil_CreateAllocationGroup (void) |
void | PaUtil_DestroyAllocationGroup (PaUtilAllocationGroup *group) |
void * | PaUtil_GroupAllocateMemory (PaUtilAllocationGroup *group, long size) |
void | PaUtil_GroupFreeMemory (PaUtilAllocationGroup *group, void *buffer) |
void | PaUtil_FreeAllAllocations (PaUtilAllocationGroup *group) |
An allocation group is useful for keeping track of multiple blocks of memory which are allocated at the same time (such as during initialization) and need to be deallocated at the same time. The allocation group maintains a list of allocated blocks, and can deallocate them all simultaneously which can be usefull for cleaning up after a partially initialized object fails.
The allocation group implementation is built on top of the lower level allocation functions defined in pa_util.h
PaUtilAllocationGroup* PaUtil_CreateAllocationGroup | ( | void | ) |
Create an allocation group.
void PaUtil_DestroyAllocationGroup | ( | PaUtilAllocationGroup * | group | ) |
Destroy an allocation group, but not the memory allocated through the group.
void PaUtil_FreeAllAllocations | ( | PaUtilAllocationGroup * | group | ) |
Free all blocks of memory which have been allocated through the allocation group. This function doesn't destroy the group itself.
void* PaUtil_GroupAllocateMemory | ( | PaUtilAllocationGroup * | group, | |
long | size | |||
) |
Allocate a block of memory though an allocation group.
void PaUtil_GroupFreeMemory | ( | PaUtilAllocationGroup * | group, | |
void * | buffer | |||
) |
Free a block of memory that was previously allocated though an allocation group. Calling this function is a relatively time consuming operation. Under normal circumstances clients should call PaUtil_FreeAllAllocations to free all allocated blocks simultaneously.