Blender V4.3
BLI_mempool.h File Reference

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
 
void * BLI_mempool_alloc (BLI_mempool *pool) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(1)
 
void * BLI_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 elem_num_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)
 
void * BLI_mempool_findelem (BLI_mempool *pool, unsigned int index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
 
void BLI_mempool_as_array (BLI_mempool *pool, void *data) ATTR_NONNULL(1
 
void void * BLI_mempool_as_arrayN (BLI_mempool *pool, const char *allocstr) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
 
void void void BLI_mempool_set_memory_debug (void)
 
void BLI_mempool_iternew (BLI_mempool *pool, BLI_mempool_iter *iter) ATTR_NONNULL()
 
void * BLI_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 21 of file BLI_mempool.h.

◆ BLI_mempool_iter

typedef struct BLI_mempool_iter 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 85 of file BLI_mempool.h.

Function Documentation

◆ BLI_mempool_alloc()

◆ BLI_mempool_as_array()

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 * 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 blender::ed::outliner::write_space_outliner().

◆ BLI_mempool_calloc()

◆ BLI_mempool_clear()

void BLI_mempool_clear ( BLI_mempool * pool)

◆ BLI_mempool_clear_ex()

void void BLI_mempool_clear_ex ( BLI_mempool * pool,
int elem_num_reserve )

Empty the pool, as if it were just created.

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

Definition at line 808 of file BLI_mempool.c.

References mempool_chunk_add(), mempool_chunk_find(), mempool_chunk_free(), mempool_maxchunks(), BLI_mempool_chunk::next, NULL, 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_destroy()

◆ BLI_mempool_findelem()

◆ BLI_mempool_free()

◆ BLI_mempool_iternew()

◆ BLI_mempool_iterstep()

◆ BLI_mempool_len()

◆ BLI_mempool_set_memory_debug()

void void void BLI_mempool_set_memory_debug ( void )

Definition at line 873 of file BLI_mempool.c.

References mempool_debug_memset.

Referenced by arg_handle_debug_mode_set().