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 | Protected Attributes
FBlockAllocator Class Reference

FBlockAllocator provides a simple allocator that works on larger blocks of memory. More...

#include <fmemory.h>

Public Member Functions

 FBlockAllocator (uint32 blockSize)
 Constructor. More...
 
 ~FBlockAllocator ()
 Destructor. Releases allocated memory back to the heap. More...
 
void * allocate (uint32 size)
 allocate memory from within a preallocated memory block. If size is larger than blockSize, blockSize is increased in multiples of 2. More...
 
void free (void *p)
 free memory allocated with allocate() More...
 

Protected Attributes

TArray< Block > blocks
 
uint32 blockSize
 
FLock lock
 

Detailed Description

FBlockAllocator provides a simple allocator that works on larger blocks of memory.

FBlockAllocator is used to allocate chunks of memory that are placed in larger memory blocks.

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

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

Constructor & Destructor Documentation

FBlockAllocator ( uint32  blockSize)

Constructor.

Parameters
[in]blockSize: size of the memory blocks, that provide space for smaller allocations

Destructor. Releases allocated memory back to the heap.

Member Function Documentation

void * allocate ( uint32  size)

allocate memory from within a preallocated memory block. If size is larger than blockSize, blockSize is increased in multiples of 2.

void free ( void *  p)

free memory allocated with allocate()

Field Documentation

TArray<Block> blocks
protected
uint32 blockSize
protected
FLock lock
protected
Empty

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