|
Blender V5.0
|
#include <algorithm>#include <cstdlib>#include <cstring>#include "BLI_utildefines.h"#include "BLI_memblock.h"#include "MEM_guardedalloc.h"#include "BLI_strict_flags.h"Go to the source code of this file.
Classes | |
| struct | BLI_memblock |
Macros | |
| #define | CHUNK_LIST_SIZE 16 |
Functions | |
| BLI_memblock * | BLI_memblock_create_ex (uint elem_size, uint chunk_size) |
| void | BLI_memblock_destroy (BLI_memblock *mblk, MemblockValFreeFP free_callback) |
| void | BLI_memblock_clear (BLI_memblock *mblk, MemblockValFreeFP free_callback) |
| void * | BLI_memblock_alloc (BLI_memblock *mblk) |
| void | BLI_memblock_iternew (BLI_memblock *mblk, BLI_memblock_iter *iter) |
| void * | BLI_memblock_iterstep (BLI_memblock_iter *iter) |
| void * | BLI_memblock_elem_get (BLI_memblock *mblk, int chunk, int elem) |
Dead simple, fast memory allocator for allocating many elements of the same size.
Definition in file BLI_memblock.cc.
| #define CHUNK_LIST_SIZE 16 |
Definition at line 23 of file BLI_memblock.cc.
Referenced by BLI_memblock_alloc(), BLI_memblock_clear(), and BLI_memblock_create_ex().
| 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().