Blender  V3.3
Classes | Typedefs | Enumerations | Functions
BLI_mempool.h File Reference
#include "BLI_compiler_attrs.h"
#include "BLI_utildefines.h"

Go to the source code of this file.

Classes

struct  BLI_mempool_iter
 

Typedefs

typedef struct BLI_mempool BLI_mempool
 
typedef struct BLI_mempool_iter BLI_mempool_iter
 

Enumerations

enum  { BLI_MEMPOOL_NOP = 0 , BLI_MEMPOOL_ALLOW_ITER = (1 << 0) }
 

Functions

BLI_mempoolBLI_mempool_create (unsigned int esize, unsigned int elem_num, unsigned int pchunk, unsigned int flag) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL
 
voidBLI_mempool_alloc (BLI_mempool *pool) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(1)
 
voidBLI_mempool_calloc (BLI_mempool *pool) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(1)
 
void BLI_mempool_free (BLI_mempool *pool, void *addr) ATTR_NONNULL(1
 
void void BLI_mempool_clear_ex (BLI_mempool *pool, int totelem_reserve) ATTR_NONNULL(1)
 
void BLI_mempool_clear (BLI_mempool *pool) ATTR_NONNULL(1)
 
void BLI_mempool_destroy (BLI_mempool *pool) ATTR_NONNULL(1)
 
int BLI_mempool_len (const BLI_mempool *pool) ATTR_NONNULL(1)
 
voidBLI_mempool_findelem (BLI_mempool *pool, unsigned int index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
 
void BLI_mempool_as_table (BLI_mempool *pool, void **data) ATTR_NONNULL(1
 
void void ** BLI_mempool_as_tableN (BLI_mempool *pool, const char *allocstr) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
 
void void void BLI_mempool_as_array (BLI_mempool *pool, void *data) ATTR_NONNULL(1
 
void void void voidBLI_mempool_as_arrayN (BLI_mempool *pool, const char *allocstr) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
 
void void void void void BLI_mempool_set_memory_debug (void)
 
void BLI_mempool_iternew (BLI_mempool *pool, BLI_mempool_iter *iter) ATTR_NONNULL()
 
voidBLI_mempool_iterstep (BLI_mempool_iter *iter) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
 

Typedef Documentation

◆ BLI_mempool

typedef struct BLI_mempool BLI_mempool

Definition at line 1 of file BLI_mempool.h.

◆ BLI_mempool_iter

Iteration stuff.

Note
this may easy to produce bugs with.
Private structure.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

BLI_mempool.flag

Enumerator
BLI_MEMPOOL_NOP 
BLI_MEMPOOL_ALLOW_ITER 

allow iterating on this mempool.

Note
this requires that the first four bytes of the elements never begin with 'free' (FREEWORD).
order of iteration is only assured to be the order of allocation when no chunks have been freed.

Definition at line 98 of file BLI_mempool.h.

Function Documentation

◆ BLI_mempool_alloc()

void* BLI_mempool_alloc ( BLI_mempool pool)

◆ BLI_mempool_as_array()

void void void BLI_mempool_as_array ( BLI_mempool pool,
void data 
)

Fill in data with the contents of the mempool.

◆ BLI_mempool_as_arrayN()

void void void void* BLI_mempool_as_arrayN ( BLI_mempool pool,
const char *  allocstr 
)

A version of BLI_mempool_as_array that allocates and returns the data.

Referenced by write_space_outliner().

◆ BLI_mempool_as_table()

void BLI_mempool_as_table ( BLI_mempool pool,
void **  data 
)

Fill in data with pointers to each element of the mempool, to create lookup table.

Parameters
poolPool to create a table from.
dataarray of pointers at least the size of 'pool->totused'

◆ BLI_mempool_as_tableN()

void void** BLI_mempool_as_tableN ( BLI_mempool pool,
const char *  allocstr 
)

A version of BLI_mempool_as_table that allocates and returns the data.

◆ BLI_mempool_calloc()

void* BLI_mempool_calloc ( BLI_mempool pool)

◆ BLI_mempool_clear()

void BLI_mempool_clear ( BLI_mempool pool)

◆ BLI_mempool_clear_ex()

void void BLI_mempool_clear_ex ( BLI_mempool pool,
int  totelem_reserve 
)

Empty the pool, as if it were just created.

Parameters
poolThe pool to clear.
totelem_reserveOptionally reserve how many items should be kept from clearing.

Definition at line 650 of file BLI_mempool.c.

References mempool_chunk_add(), mempool_chunk_find(), mempool_chunk_free(), mempool_maxchunks(), BLI_mempool_chunk::next, NULL, blender::compositor::pool, VALGRIND_CREATE_MEMPOOL, and VALGRIND_DESTROY_MEMPOOL.

Referenced by BLI_ghash_clear_ex(), BLI_mempool_clear(), and DRW_instance_data_list_resize().

◆ BLI_mempool_create()

BLI_mempool* BLI_mempool_create ( unsigned int  esize,
unsigned int  elem_num,
unsigned int  pchunk,
unsigned int  flag 
)

◆ BLI_mempool_destroy()

void BLI_mempool_destroy ( BLI_mempool pool)

◆ BLI_mempool_findelem()

void* BLI_mempool_findelem ( BLI_mempool pool,
unsigned int  index 
)

◆ BLI_mempool_free()

void BLI_mempool_free ( BLI_mempool pool,
void addr 
)

◆ BLI_mempool_iternew()

void BLI_mempool_iternew ( BLI_mempool pool,
BLI_mempool_iter iter 
)

◆ BLI_mempool_iterstep()

void* BLI_mempool_iterstep ( BLI_mempool_iter iter)

◆ BLI_mempool_len()

int BLI_mempool_len ( const BLI_mempool pool)

◆ BLI_mempool_set_memory_debug()

void void void void void BLI_mempool_set_memory_debug ( void  )

Definition at line 719 of file BLI_mempool.c.

References mempool_debug_memset.

Referenced by arg_handle_debug_mode_set().