Base Module  VST 3.6.6
SDK for developing VST Plug-in
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Public Member Functions
FObjectPool Class Reference

FObjectPool allocates objects in blocks with MAX_USHORT elements per block. More...

#include <fmemory.h>

Public Member Functions

 FObjectPool (uint16 elementSize)
 Constructor. More...
 
 ~FObjectPool ()
 Destructor. Releases allocated memory back to the heap. More...
 
void * newElement ()
 allocate memory from within the preallocated memory block. If no more free entries are found, a new memory block is allocated. More...
 
void deleteElement (void *el)
 return element to the pool. More...
 

Detailed Description

FObjectPool allocates objects in blocks with MAX_USHORT elements per block.

FObjectPool can be used, if a lot of small equal sized elements are needed. Allocation and deallocation are fast and have little memory overhead. FObjectPool should not be used for large objects.

Memory is not released to the heap until the destructor of FBlockAllocator.

FObjectPool is thread safe, as it uses FLock to synchronize modifications.

Constructor & Destructor Documentation

FObjectPool ( uint16  elementSize)

Constructor.

Parameters
[in]elementSize: size of one element

Destructor. Releases allocated memory back to the heap.

Member Function Documentation

void * newElement ( )

allocate memory from within the preallocated memory block. If no more free entries are found, a new memory block is allocated.

void deleteElement ( void *  el)

return element to the pool.

Empty

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