FMemoryBlockPool Class Reference

FMemoryBlockPool provides a pool of equal sized preallocated memory blocks. More...

#include <fmemory.h>

Public Member Functions

 FMemoryBlockPool (uint32 delta, uint32 elementSize)
 Constructor specifying the properties of the pool.
 ~FMemoryBlockPool ()
 destructor
void * newElement ()
 allocate an uninitialized memory block from the pool.
void deleteElement (void *el)
 return a block, that has been allocated with newElement ()

Detailed Description

FMemoryBlockPool provides a pool of equal sized preallocated memory blocks.

When a lot of equal sized objects are needed, FMemoryPool can be used for fast allocation and with little memory overhead. A standard application is overloading the new operator of a class that is often allocated and deallocated.

FMemoryPool starts empty and preallocates a given number of memory blocks from the heap. If a block is returned to the pool, it is placed on top of a stack of cached objects that are used for fast handling of later allocations.

Memory is not released to the heap until the destructor.

FMemoryPool is thread safe, as it uses FLock to synchronize modifications to the pool.

See also:
FMemoryPool

Constructor & Destructor Documentation

FMemoryBlockPool ( uint32  delta,
uint32  elementSize 
)

Constructor specifying the properties of the pool.

Parameters:
[in] delta : number of memory blocks that are preallocated when there is no unused block available
[in] elementSize : the size of each memory block. It must be greater than sizeof(void*).
~FMemoryBlockPool (  ) 

destructor


Member Function Documentation

void * newElement (  ) 

allocate an uninitialized memory block from the pool.

void deleteElement ( void *  el  ) 

return a block, that has been allocated with newElement ()

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
Empty

Copyright ©2013 Steinberg Media Technologies GmbH. All Rights Reserved.