PortAudio  2.0
Data Structures | Functions
pa_allocation.h File Reference

Allocation Group prototypes. An Allocation Group makes it easy to allocate multiple blocks of memory and free them all at once. More...

Go to the source code of this file.

Data Structures

struct  PaUtilAllocationGroup
 

Functions

PaUtilAllocationGroupPaUtil_CreateAllocationGroup (void)
 
void PaUtil_DestroyAllocationGroup (PaUtilAllocationGroup *group)
 
void * PaUtil_GroupAllocateZeroInitializedMemory (PaUtilAllocationGroup *group, long size)
 
void PaUtil_GroupFreeMemory (PaUtilAllocationGroup *group, void *buffer)
 
void PaUtil_FreeAllAllocations (PaUtilAllocationGroup *group)
 

Detailed Description

Allocation Group prototypes. An Allocation Group makes it easy to allocate multiple blocks of memory and free them all at once.

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 free all allocations at once. This can be useful 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

Function Documentation

PaUtilAllocationGroup* PaUtil_CreateAllocationGroup ( void  )
void PaUtil_DestroyAllocationGroup ( PaUtilAllocationGroup group)
void PaUtil_FreeAllAllocations ( PaUtilAllocationGroup group)
void* PaUtil_GroupAllocateZeroInitializedMemory ( PaUtilAllocationGroup group,
long  size 
)
void PaUtil_GroupFreeMemory ( PaUtilAllocationGroup group,
void *  buffer 
)

Free a block of memory that was allocated through the specified 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.

See Also
PaUtil_FreeAllAllocations

References PaUtilAllocationGroup::allocations, PaUtilAllocationGroupLink::buffer, PaUtilAllocationGroupLink::next, PaUtil_FreeMemory(), and PaUtilAllocationGroup::spareLinks.