|
Blender V5.0
|
Go to the source code of this file.
Classes | |
| struct | BLI_memblock_iter |
Macros | |
| #define | BLI_MEM_BLOCK_CHUNK_SIZE (1 << 15) /* 32KiB */ |
| #define | BLI_memblock_create(elem_size) |
Typedefs | |
| typedef struct BLI_memblock | BLI_memblock |
| typedef void(* | MemblockValFreeFP) (void *val) |
| typedef struct BLI_memblock_iter | BLI_memblock_iter |
Functions | |
| BLI_memblock * | BLI_memblock_create_ex (uint elem_size, uint chunk_size) ATTR_WARN_UNUSED_RESULT |
| void * | BLI_memblock_alloc (BLI_memblock *mblk) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) |
| void | BLI_memblock_clear (BLI_memblock *mblk, MemblockValFreeFP free_callback) ATTR_NONNULL(1) |
| void | BLI_memblock_destroy (BLI_memblock *mblk, MemblockValFreeFP free_callback) ATTR_NONNULL(1) |
| void | BLI_memblock_iternew (BLI_memblock *mblk, BLI_memblock_iter *iter) ATTR_NONNULL() |
| void * | BLI_memblock_iterstep (BLI_memblock_iter *iter) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() |
| void * | BLI_memblock_elem_get (BLI_memblock *mblk, int chunk, int elem) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() |
| #define BLI_MEM_BLOCK_CHUNK_SIZE (1 << 15) /* 32KiB */ |
Definition at line 14 of file BLI_memblock.h.
| #define BLI_memblock_create | ( | elem_size | ) |
Definition at line 30 of file BLI_memblock.h.
| typedef struct BLI_memblock BLI_memblock |
Definition at line 18 of file BLI_memblock.h.
| typedef struct BLI_memblock_iter BLI_memblock_iter |
| typedef void(* MemblockValFreeFP) (void *val) |
Definition at line 19 of file BLI_memblock.h.
| void * BLI_memblock_alloc | ( | BLI_memblock * | mblk | ) |
Definition at line 115 of file BLI_memblock.cc.
References BLI_memblock::chunk_len, BLI_memblock::chunk_list, CHUNK_LIST_SIZE, BLI_memblock::chunk_max_ofs, BLI_memblock::chunk_next, BLI_memblock::chunk_size, BLI_memblock::elem_last, BLI_memblock::elem_next, BLI_memblock::elem_next_ofs, BLI_memblock::elem_size, MEM_mallocN_aligned(), MEM_recallocN, ptr, and UNLIKELY.
Referenced by blender::draw::gpencil::gpencil_light_pool_add(), blender::draw::gpencil::gpencil_material_pool_add(), blender::draw::gpencil::gpencil_object_cache_add(), and blender::draw::gpencil::grease_pencil_layer_cache_add().
| void BLI_memblock_clear | ( | BLI_memblock * | mblk, |
| MemblockValFreeFP | free_callback ) |
Reset elem count to 0 but keep as much memory allocated needed for at least the previous elem count.
Definition at line 85 of file BLI_memblock.cc.
References BLI_memblock::chunk_len, BLI_memblock::chunk_list, CHUNK_LIST_SIZE, BLI_memblock::chunk_next, BLI_memblock::chunk_size, BLI_memblock::elem_last, BLI_memblock::elem_next, BLI_memblock::elem_next_ofs, BLI_memblock::elem_size, i, MEM_recallocN, MEM_SAFE_FREE, and UNLIKELY.
Referenced by blender::draw::gpencil::Instance::init().
| BLI_memblock * BLI_memblock_create_ex | ( | uint | elem_size, |
| uint | chunk_size ) |
Definition at line 46 of file BLI_memblock.cc.
References BLI_assert, BLI_memblock::chunk_len, BLI_memblock::chunk_list, CHUNK_LIST_SIZE, BLI_memblock::chunk_max_ofs, BLI_memblock::chunk_next, BLI_memblock::chunk_size, BLI_memblock::elem_last, BLI_memblock::elem_next, BLI_memblock::elem_next_ofs, BLI_memblock::elem_size, MEM_calloc_arrayN(), MEM_callocN(), and MEM_mallocN_aligned().
| void BLI_memblock_destroy | ( | BLI_memblock * | mblk, |
| MemblockValFreeFP | free_callback ) |
Definition at line 65 of file BLI_memblock.cc.
References BLI_memblock::chunk_len, BLI_memblock::chunk_list, BLI_memblock::chunk_size, BLI_memblock::elem_last, BLI_memblock::elem_size, i, MEM_freeN(), and MEM_SAFE_FREE.
Referenced by blender::draw::gpencil::Instance::~Instance().
| void * BLI_memblock_elem_get | ( | BLI_memblock * | mblk, |
| int | chunk, | ||
| int | elem ) |
Direct access. elem is element index inside the chosen chunk. Double usage: You can set chunk to 0 and set the absolute elem index. The correct chunk will be retrieve.
Definition at line 175 of file BLI_memblock.cc.
References BLI_assert, BLI_memblock::chunk_list, BLI_memblock::chunk_size, and BLI_memblock::elem_size.
| void BLI_memblock_iternew | ( | BLI_memblock * | mblk, |
| BLI_memblock_iter * | iter ) |
Definition at line 144 of file BLI_memblock.cc.
References BLI_memblock_iter::chunk_idx, BLI_memblock::chunk_list, BLI_memblock_iter::chunk_list, BLI_memblock::chunk_max_ofs, BLI_memblock_iter::chunk_max_ofs, BLI_memblock_iter::cur_index, BLI_memblock::elem_next, BLI_memblock_iter::elem_ofs, BLI_memblock::elem_size, BLI_memblock_iter::elem_size, and BLI_memblock_iter::end_index.
Referenced by blender::draw::gpencil::Instance::end_sync().
| void * BLI_memblock_iterstep | ( | BLI_memblock_iter * | iter | ) |
Definition at line 156 of file BLI_memblock.cc.
References BLI_memblock_iter::chunk_idx, BLI_memblock_iter::chunk_list, BLI_memblock_iter::chunk_max_ofs, BLI_memblock_iter::cur_index, BLI_memblock_iter::elem_ofs, BLI_memblock_iter::elem_size, BLI_memblock_iter::end_index, and ptr.
Referenced by blender::draw::gpencil::Instance::end_sync().