Blender V2.61 - r43446
|
Simple fast memory allocator. More...
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 |
Functions | |
BLI_mempool * | BLI_mempool_create (int esize, int tote, int pchunk, short use_sysmalloc, short allow_iter) |
void * | BLI_mempool_alloc (BLI_mempool *pool) |
void * | BLI_mempool_calloc (BLI_mempool *pool) |
void | BLI_mempool_free (BLI_mempool *pool, void *addr) |
void | BLI_mempool_destroy (BLI_mempool *pool) |
int | BLI_mempool_count (BLI_mempool *pool) |
void * | BLI_mempool_findelem (BLI_mempool *pool, int index) |
void | BLI_mempool_allow_iter (BLI_mempool *pool) |
void | BLI_mempool_iternew (BLI_mempool *pool, BLI_mempool_iter *iter) |
void * | BLI_mempool_iterstep (BLI_mempool_iter *iter) |
Simple fast memory allocator.
Definition in file BLI_mempool.h.
typedef struct BLI_mempool BLI_mempool |
Definition at line 45 of file BLI_mempool.h.
typedef struct BLI_mempool_iter BLI_mempool_iter |
iteration stuff. note: this may easy to produce bugs with
void* BLI_mempool_alloc | ( | BLI_mempool * | pool | ) |
Definition at line 149 of file BLI_mempool.c.
References BLI_mempool::allow_iter, BLI_addtail(), BLI_mempool::chunks, BLI_mempool::csize, BLI_mempool_chunk::data, BLI_mempool::esize, BLI_mempool::free, BLI_freenode::freeword, FREEWORD, MEM_mallocN(), BLI_freenode::next, BLI_mempool_chunk::next, NULL, BLI_mempool::pchunk, BLI_mempool_chunk::prev, BLI_mempool::totalloc, BLI_mempool::totused, and BLI_mempool::use_sysmalloc.
Referenced by BLI_edgehash_insert(), BLI_ghash_insert(), BLI_mempool_calloc(), BME_addedgelist(), BME_addpolylist(), BME_addvertlist(), BME_CD_alloc_block(), BME_create_loop(), and IMB_moviecache_put().
void BLI_mempool_allow_iter | ( | BLI_mempool * | pool | ) |
void* BLI_mempool_calloc | ( | BLI_mempool * | pool | ) |
Definition at line 194 of file BLI_mempool.c.
References BLI_mempool_alloc(), and BLI_mempool::esize.
Referenced by CustomData_bmesh_alloc_block().
int BLI_mempool_count | ( | BLI_mempool * | pool | ) |
BLI_mempool* BLI_mempool_create | ( | int | esize, |
int | tote, | ||
int | pchunk, | ||
short | use_sysmalloc, | ||
short | allow_iter | ||
) |
Definition at line 84 of file BLI_mempool.c.
References BLI_mempool::allow_iter, BLI_addtail(), BLI_mempool::chunks, BLI_mempool::csize, BLI_mempool_chunk::data, BLI_mempool::esize, ListBase::first, BLI_mempool::free, FREEWORD, BLI_freenode::freeword, i, ListBase::last, MAX2, MEM_mallocN(), MEMPOOL_ELEM_SIZE_MIN, BLI_freenode::next, BLI_mempool_chunk::next, NULL, BLI_mempool::pchunk, BLI_mempool_chunk::prev, BLI_mempool::totalloc, BLI_mempool::totused, and BLI_mempool::use_sysmalloc.
Referenced by BLI_edgehash_new(), BLI_ghash_new(), BME_CD_Create(), BME_make_mesh(), CustomData_bmesh_init_pool(), and IMB_moviecache_create().
void BLI_mempool_destroy | ( | BLI_mempool * | pool | ) |
Definition at line 340 of file BLI_mempool.c.
References BLI_freelist(), BLI_freelistN(), BLI_mempool::chunks, BLI_mempool_chunk::data, ListBase::first, addon::engine::free(), MEM_freeN(), BLI_mempool_chunk::next, NULL, and BLI_mempool::use_sysmalloc.
Referenced by BLI_edgehash_free(), BLI_ghash_free(), BME_CD_Free(), BME_free_mesh(), and IMB_moviecache_free().
void* BLI_mempool_findelem | ( | BLI_mempool * | pool, |
int | index | ||
) |
Definition at line 244 of file BLI_mempool.c.
References BLI_mempool::allow_iter, BLI_mempool_iternew(), BLI_mempool_iterstep(), and NULL.
void BLI_mempool_free | ( | BLI_mempool * | pool, |
void * | addr | ||
) |
Definition at line 202 of file BLI_mempool.c.
References BLI_mempool::allow_iter, BLI_addtail(), BLI_freelist(), BLI_freelistN(), BLI_remlink(), BLI_mempool::chunks, BLI_mempool_chunk::data, BLI_mempool::esize, ListBase::first, addon::engine::free(), BLI_mempool::free, FREEWORD, BLI_freenode::freeword, i, MEM_freeN(), BLI_mempool_chunk::next, BLI_freenode::next, NULL, BLI_mempool::pchunk, BLI_mempool::totalloc, BLI_mempool::totused, and BLI_mempool::use_sysmalloc.
Referenced by BLI_edgehash_clear(), BLI_ghash_remove(), BME_CD_free_block(), BME_free_edge(), BME_free_loop(), BME_free_poly(), BME_free_vert(), CustomData_bmesh_free_block(), moviecache_keyfree(), and moviecache_valfree().
void BLI_mempool_iternew | ( | BLI_mempool * | pool, |
BLI_mempool_iter * | iter | ||
) |
Definition at line 262 of file BLI_mempool.c.
References BLI_mempool::allow_iter, BLI_mempool::chunks, BLI_mempool_iter::curchunk, BLI_mempool_iter::curindex, ListBase::first, NULL, and BLI_mempool_iter::pool.
Referenced by BLI_mempool_findelem().
void* BLI_mempool_iterstep | ( | BLI_mempool_iter * | iter | ) |
Definition at line 313 of file BLI_mempool.c.
References BLI_mempool_iter::curchunk, BLI_mempool_iter::curindex, BLI_mempool_chunk::data, BLI_mempool::esize, BLI_freenode::freeword, FREEWORD, LIKELY, BLI_mempool_chunk::next, NULL, BLI_mempool::pchunk, BLI_mempool_iter::pool, BLI_mempool::totused, and UNLIKELY.
Referenced by BLI_mempool_findelem().