|
Blender V4.3
|
#include <stdlib.h>#include <string.h>#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.c.
| #define CHUNK_LIST_SIZE 16 |
Definition at line 22 of file BLI_memblock.c.
Referenced by BLI_memblock_alloc(), BLI_memblock_clear(), and BLI_memblock_create_ex().
| void * BLI_memblock_alloc | ( | BLI_memblock * | mblk | ) |
Definition at line 113 of file BLI_memblock.c.
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, NULL, ptr, and UNLIKELY.
Referenced by draw_unit_state_create(), drw_command_create(), DRW_pass_create(), drw_resource_handle_new(), DRW_shgroup_call_buffer(), DRW_shgroup_call_buffer_instance(), drw_shgroup_create_ex(), DRW_shgroup_create_sub(), drw_shgroup_material_texture(), drw_shgroup_uniform_create_ex(), DRW_temp_batch_instance_request(), DRW_temp_batch_request(), DRW_temp_buffer_request(), DRW_view_create(), DRW_view_create_sub(), gpencil_layer_cache_add(), gpencil_light_pool_add(), gpencil_material_pool_add(), gpencil_object_cache_add(), gpencil_vfx_pass_create(), and 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 84 of file BLI_memblock.c.
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, MEM_recallocN, MEM_SAFE_FREE, and UNLIKELY.
Referenced by DRW_instance_buffer_finish(), drw_viewport_data_reset(), and GPENCIL_engine_init().
| BLI_memblock * BLI_memblock_create_ex | ( | uint | elem_size, |
| uint | chunk_size ) |
Definition at line 45 of file BLI_memblock.c.
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, int, MEM_callocN, MEM_mallocN, and MEM_mallocN_aligned().
Referenced by DRW_viewport_data_create().
| void BLI_memblock_destroy | ( | BLI_memblock * | mblk, |
| MemblockValFreeFP | free_callback ) |
Definition at line 64 of file BLI_memblock.c.
References BLI_memblock::chunk_len, BLI_memblock::chunk_list, BLI_memblock::chunk_size, BLI_memblock::elem_last, BLI_memblock::elem_size, MEM_freeN(), and MEM_SAFE_FREE.
Referenced by DRW_instance_data_list_free(), DRW_viewport_data_free(), and gpencil_view_layer_data_free().
| 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 174 of file BLI_memblock.c.
References BLI_assert, BLI_memblock::chunk_list, BLI_memblock::chunk_size, and BLI_memblock::elem_size.
Referenced by DRW_memblock_elem_from_handle(), and drw_resource_buffer_finish().
| void BLI_memblock_iternew | ( | BLI_memblock * | mblk, |
| BLI_memblock_iter * | iter ) |
Definition at line 143 of file BLI_memblock.c.
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 draw_compute_culling(), draw_texture_release(), DRW_instance_buffer_finish(), drw_resource_buffer_finish(), and GPENCIL_cache_finish().
| void * BLI_memblock_iterstep | ( | BLI_memblock_iter * | iter | ) |
Definition at line 155 of file BLI_memblock.c.
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, NULL, and ptr.
Referenced by draw_compute_culling(), draw_texture_release(), DRW_instance_buffer_finish(), drw_resource_buffer_finish(), and GPENCIL_cache_finish().