MLT  7.28.0
Public Member Functions | Data Fields | Private Member Functions
mlt_pool_s Struct Reference

Pool (memory) class. More...

Public Member Functions

void * mlt_pool_alloc (int size)
 Allocate size bytes from the pool. More...
 
void mlt_pool_close ()
 Close the pool. More...
 
void mlt_pool_init ()
 Initialise the global pool. More...
 
void mlt_pool_purge ()
 Purge unused items in the pool. More...
 
void * mlt_pool_realloc (void *ptr, int size)
 Allocate size bytes from the pool. More...
 
void mlt_pool_release (void *release)
 Release the allocated memory. More...
 

Data Fields

int count
 the number of blocks in the pool More...
 
pthread_mutex_t lock
 lock to prevent race conditions More...
 
int size
 the size of the memory block as a power of 2 More...
 
mlt_deque stack
 a stack of addresses to memory blocks More...
 

Private Member Functions

static void pool_close (mlt_pool self)
 Destroy a pool. More...
 
static void * pool_fetch (mlt_pool self)
 Get an item from the pool. More...
 
static mlt_pool pool_init (int size)
 Create a pool. More...
 
static void pool_return (void *ptr)
 Return an item to the pool. More...
 

Detailed Description

Pool (memory) class.

Member Function Documentation

◆ mlt_pool_alloc()

void * mlt_pool_alloc ( int  size)

Allocate size bytes from the pool.

Parameters
sizethe number of bytes

◆ mlt_pool_close()

void mlt_pool_close ( )

Close the pool.

◆ mlt_pool_init()

void mlt_pool_init ( )

Initialise the global pool.

◆ mlt_pool_purge()

void mlt_pool_purge ( )

Purge unused items in the pool.

A form of garbage collection.

◆ mlt_pool_realloc()

void * mlt_pool_realloc ( void *  ptr,
int  size 
)

Allocate size bytes from the pool.

Parameters
ptran opaque pointer - can be in the pool or a new block to allocate
sizethe number of bytes

◆ mlt_pool_release()

void mlt_pool_release ( void *  release)

Release the allocated memory.

Parameters
releasean opaque pointer of a block in the pool

◆ pool_close()

static void pool_close ( mlt_pool  self)
private

Destroy a pool.

Parameters
selfa pool

◆ pool_fetch()

static void * pool_fetch ( mlt_pool  self)
private

Get an item from the pool.

Parameters
selfa pool
Returns
an opaque pointer

◆ pool_init()

static mlt_pool pool_init ( int  size)
private

Create a pool.

Parameters
sizethe size of the memory blocks to hold as some power of two
Returns
a new pool object

◆ pool_return()

static void pool_return ( void *  ptr)
private

Return an item to the pool.

Parameters
ptran opaque pointer

Field Documentation

◆ count

int mlt_pool_s::count

the number of blocks in the pool

◆ lock

pthread_mutex_t mlt_pool_s::lock

lock to prevent race conditions

◆ size

int mlt_pool_s::size

the size of the memory block as a power of 2

◆ stack

mlt_deque mlt_pool_s::stack

a stack of addresses to memory blocks


The documentation for this struct was generated from the following file: