|
Blender
V2.93
|
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) } |
| typedef struct BLI_mempool BLI_mempool |
Definition at line 1 of file BLI_mempool.h.
| typedef struct BLI_mempool_iter BLI_mempool_iter |
iteration stuff. note: this may easy to produce bugs with
| anonymous enum |
| Enumerator | |
|---|---|
| BLI_MEMPOOL_NOP | |
| BLI_MEMPOOL_ALLOW_ITER | allow iterating on this mempool.
|
Definition at line 76 of file BLI_mempool.h.
| void* BLI_mempool_alloc | ( | BLI_mempool * | pool | ) |
Definition at line 334 of file BLI_mempool.c.
References BLI_assert, BLI_MEMPOOL_ALLOW_ITER, BLI_freenode::freeword, mempool_chunk_add(), mempool_chunk_alloc(), BLI_freenode::next, NULL, blender::compositor::pool, UNLIKELY, USEDWORD, and VALGRIND_MEMPOOL_ALLOC.
Referenced by bchunk_list_append_only(), bchunk_list_new(), bchunk_new(), BKE_image_pool_acquire_ibuf(), BLI_ghash_ensure_p(), BLI_ghash_ensure_p_ex(), BLI_gset_ensure_p_ex(), BLI_linklist_append_pool(), BLI_linklist_prepend_pool(), BLI_mempool_calloc(), BM_edge_create(), bm_face_create__internal(), bm_log_face_alloc(), bm_log_vert_alloc(), bm_loop_create(), BM_mesh_beautify_fill(), BM_mesh_rebuild(), bm_uuidwalk_facestep_begin(), bm_uuidwalk_pass_add(), BM_vert_create(), bmo_flag_layer_free(), BMW_state_add(), check_persistent(), CustomData_bmesh_alloc_block(), direct_link_area(), do_moviecache_put(), DRW_instance_data_next(), edge_queue_insert(), ghash_copy(), ghash_insert_ex(), ghash_insert_ex_keyonly(), main_relations_create_idlink_cb(), outliner_storage_cleanup(), seq_cache_allocate_key(), seq_cache_put_ex(), state_link_add(), tbb_task_pool_run(), TEST(), and vs_add().
| void void void BLI_mempool_as_array | ( | BLI_mempool * | pool, |
| void * | data | ||
| ) |
| void void void void* BLI_mempool_as_arrayN | ( | BLI_mempool * | pool, |
| const char * | allocstr | ||
| ) |
Referenced by write_space_outliner().
| void BLI_mempool_as_table | ( | BLI_mempool * | pool, |
| void ** | data | ||
| ) |
| void void** BLI_mempool_as_tableN | ( | BLI_mempool * | pool, |
| const char * | allocstr | ||
| ) |
| void* BLI_mempool_calloc | ( | BLI_mempool * | pool | ) |
Definition at line 362 of file BLI_mempool.c.
References BLI_mempool_alloc(), and blender::compositor::pool.
Referenced by BM_edge_create(), bm_face_boundary_add(), bm_face_create__internal(), bm_face_create__sfme(), BM_mesh_elem_toolflags_ensure(), BM_mesh_rebuild(), BM_vert_create(), bmo_flag_layer_alloc(), bmo_planar_faces_exec(), curve_draw_event_add(), curve_draw_stroke_from_operator_elem(), do_versions_after_linking_280(), knife_append_list(), new_knife_edge(), and new_knife_vert().
| void BLI_mempool_clear | ( | BLI_mempool * | pool | ) |
Wrap BLI_mempool_clear_ex with no reserve set.
Definition at line 749 of file BLI_mempool.c.
References BLI_mempool_clear_ex(), and blender::compositor::pool.
Referenced by BLI_array_store_clear(), bm_uuidwalk_clear(), bmo_planar_faces_exec(), and tbb_task_pool_work_and_wait().
| void void BLI_mempool_clear_ex | ( | BLI_mempool * | pool, |
| const int | totelem_reserve | ||
| ) |
Empty the pool, as if it were just created.
| pool | The pool to clear. |
| totelem_reserve | Optionally reserve how many items should be kept from clearing. |
Definition at line 694 of file BLI_mempool.c.
References mempool_chunk_add(), mempool_chunk_find(), mempool_chunk_free(), mempool_maxchunks(), BLI_mempool_chunk::next, NULL, blender::compositor::pool, VALGRIND_CREATE_MEMPOOL, and VALGRIND_DESTROY_MEMPOOL.
Referenced by BLI_ghash_clear_ex(), BLI_mempool_clear(), and DRW_instance_data_list_resize().
| BLI_mempool* BLI_mempool_create | ( | unsigned int | esize, |
| unsigned int | totelem, | ||
| unsigned int | pchunk, | ||
| unsigned int | flag | ||
| ) |
Definition at line 268 of file BLI_mempool.c.
References BLI_assert, BLI_MEMPOOL_ALLOW_ITER, CHUNK_OVERHEAD, MAX2, MEM_mallocN, MEM_SIZE_OVERHEAD, mempool_chunk_add(), mempool_chunk_alloc(), MEMPOOL_ELEM_SIZE_MIN, mempool_maxchunks(), NULL, blender::compositor::pool, power_of_2_max_u(), and VALGRIND_CREATE_MEMPOOL.
Referenced by BKE_image_pool_new(), BKE_main_relations_create(), BKE_pbvh_bmesh_update_topology(), BLI_array_store_create(), bm_log_entry_create(), bm_mempool_init(), bm_mempool_init_ex(), BM_mesh_beautify_fill(), BM_mesh_edgeloops_find_path(), BM_mesh_edgenet(), BM_mesh_elem_toolflags_ensure(), bm_uuidwalk_init(), bmo_connect_vert_pair_exec(), bmo_flag_layer_alloc(), bmo_flag_layer_free(), bmo_planar_faces_exec(), BMW_init(), check_persistent(), curve_draw_init(), CustomData_bmesh_init_pool(), direct_link_area(), do_versions_after_linking_280(), drw_instance_data_create(), ghash_new(), IMB_moviecache_create(), knifetool_init(), outliner_storage_cleanup(), seq_cache_create(), tbb_task_pool_create(), and TEST().
| void BLI_mempool_destroy | ( | BLI_mempool * | pool | ) |
Free the mempool its self (and all elements).
Definition at line 757 of file BLI_mempool.c.
References MEM_freeN, mempool_chunk_free_all(), blender::compositor::pool, and VALGRIND_DESTROY_MEMPOOL.
Referenced by BKE_image_pool_free(), BKE_main_relations_free(), BKE_pbvh_bmesh_update_topology(), BLI_array_store_destroy(), BLI_ghash_free(), bm_log_entry_free(), BM_mesh_beautify_fill(), BM_mesh_data_free(), BM_mesh_edgeloops_find_path(), BM_mesh_edgenet(), BM_mesh_elem_toolflags_clear(), BM_mesh_rebuild(), BM_mesh_toolflags_set(), bm_uuidwalk_free(), bmo_connect_vert_pair_exec(), bmo_flag_layer_alloc(), bmo_flag_layer_free(), bmo_planar_faces_exec(), BMW_end(), curve_draw_exit(), CustomData_bmesh_merge(), DRW_instance_data_free(), IMB_moviecache_free(), knifetool_exit_ex(), outliner_free(), outliner_storage_cleanup(), seq_cache_destruct(), tbb_task_pool_free(), TEST(), and update_data_blocks().
| void* BLI_mempool_findelem | ( | BLI_mempool * | pool, |
| unsigned int | index | ||
| ) |
Definition at line 459 of file BLI_mempool.c.
References BLI_assert, BLI_MEMPOOL_ALLOW_ITER, BLI_mempool_iternew(), BLI_mempool_iterstep(), NULL, and blender::compositor::pool.
Referenced by BM_edge_at_index_find(), BM_face_at_index_find(), and BM_vert_at_index_find().
| void BLI_mempool_free | ( | BLI_mempool * | pool, |
| void * | addr | ||
| ) |
Referenced by bchunk_decref(), bchunk_list_decref(), bchunk_list_ensure_min_size_last(), BLI_ghash_pop(), BLI_ghash_popkey(), BLI_ghash_remove(), BLI_gset_pop(), BLI_gset_pop_key(), BLI_linklist_free_pool(), BLI_linklist_pop_pool(), BM_face_kill(), BM_face_kill_loose(), bm_kill_only_edge(), bm_kill_only_face(), bm_kill_only_loop(), bm_kill_only_vert(), bm_loop_path_build_step(), bm_uuidwalk_facestep_begin(), bm_uuidwalk_facestep_end(), bm_uuidwalk_facestep_free(), bmesh_kernel_join_face_kill_edge(), bmesh_kernel_split_face_make_edge(), BMW_state_remove(), CustomData_bmesh_free_block(), moviecache_keyfree(), moviecache_valfree(), pbvh_bmesh_collapse_short_edges(), pbvh_bmesh_subdivide_long_edges(), seq_cache_keyfree(), seq_cache_valfree(), and TEST().
| BLI_mempool_iter* BLI_mempool_iter_threadsafe_create | ( | BLI_mempool * | pool, |
| const size_t | num_iter | ||
| ) |
Initialize an array of mempool iterators, BLI_MEMPOOL_ALLOW_ITER flag must be set.
This is used in threaded code, to generate as much iterators as needed (each task should have its own), such that each iterator goes over its own single chunk, and only getting the next chunk to iterate over has to be protected against concurrency (which can be done in a lockless way).
To be used when creating a task for each single item in the pool is totally overkill.
See BLI_task_parallel_mempool implementation for detailed usage example.
Definition at line 561 of file BLI_mempool.c.
References BLI_assert, BLI_MEMPOOL_ALLOW_ITER, BLI_mempool_iternew(), BLI_mempool_iter::curchunk, BLI_mempool_iter::curchunk_threaded_shared, MEM_mallocN, NULL, and blender::compositor::pool.
Referenced by BLI_task_parallel_mempool().
| void BLI_mempool_iter_threadsafe_free | ( | BLI_mempool_iter * | iter_arr | ) |
Definition at line 583 of file BLI_mempool.c.
References BLI_assert, BLI_mempool_iter::curchunk_threaded_shared, MEM_freeN, and NULL.
Referenced by BLI_task_parallel_mempool().
| void BLI_mempool_iternew | ( | BLI_mempool * | pool, |
| BLI_mempool_iter * | iter | ||
| ) |
Initialize a new mempool iterator, BLI_MEMPOOL_ALLOW_ITER flag must be set.
Definition at line 537 of file BLI_mempool.c.
References BLI_assert, BLI_MEMPOOL_ALLOW_ITER, BLI_mempool_iter::curchunk, BLI_mempool_iter::curchunk_threaded_shared, BLI_mempool_iter::curindex, NULL, BLI_mempool_iter::pool, and blender::compositor::pool.
Referenced by array_store_free_data(), BKE_screen_area_blend_read_lib(), BKE_screen_foreach_id_screen_area(), BLI_array_store_calc_size_compacted_get(), BLI_array_store_is_valid(), BLI_mempool_as_array(), BLI_mempool_as_table(), BLI_mempool_findelem(), BLI_mempool_iter_threadsafe_create(), BLI_task_parallel_mempool(), bmiter__elem_of_mesh_begin(), curve_draw_exec(), curve_draw_exec_precalc(), curve_draw_stroke_3d(), curve_draw_stroke_to_operator(), fill_treehash(), knife_make_cuts(), knifetool_draw(), lib_link_workspace_layout_restore(), outliner_id_remap(), outliner_storage_cleanup(), and tbb_task_pool_work_and_wait().
| void* BLI_mempool_iterstep | ( | BLI_mempool_iter * | iter | ) |
Step over the iterator, returning the mempool item or NULL.
Definition at line 645 of file BLI_mempool.c.
References atomic_cas_ptr(), CHUNK_DATA, BLI_mempool_iter::curchunk, BLI_mempool_iter::curchunk_threaded_shared, BLI_mempool_iter::curindex, BLI_mempool::esize, FREEWORD, BLI_mempool_chunk::next, NULL, BLI_mempool::pchunk, POINTER_OFFSET, BLI_mempool_iter::pool, ret, and UNLIKELY.
Referenced by array_store_free_data(), BKE_screen_area_blend_read_lib(), BKE_screen_foreach_id_screen_area(), BLI_array_store_calc_size_compacted_get(), BLI_array_store_is_valid(), BLI_mempool_as_array(), BLI_mempool_as_table(), BLI_mempool_findelem(), BLI_task_parallel_mempool(), bmiter__elem_of_mesh_step(), curve_draw_exec(), curve_draw_exec_precalc(), curve_draw_stroke_3d(), curve_draw_stroke_to_operator(), fill_treehash(), knife_make_cuts(), knifetool_draw(), lib_link_workspace_layout_restore(), outliner_id_remap(), outliner_storage_cleanup(), parallel_mempool_func(), and tbb_task_pool_work_and_wait().
| int BLI_mempool_len | ( | BLI_mempool * | pool | ) |
Definition at line 454 of file BLI_mempool.c.
References blender::compositor::pool.
Referenced by BKE_outliner_treehash_create_from_treestore(), BKE_outliner_treehash_rebuild_from_treestore(), BLI_array_store_is_valid(), BLI_ghash_free(), BLI_task_parallel_mempool(), BM_mesh_edgenet(), bmiter__elem_of_mesh_begin(), bmiter__elem_of_mesh_step(), blender::ed::outliner::TreeDisplayScenes::buildTree(), blender::ed::outliner::TreeDisplayDataAPI::buildTree(), curve_draw_exec(), curve_draw_exec_precalc(), curve_draw_stroke_3d(), DRW_instance_data_list_resize(), knifetool_draw(), outliner_storage_cleanup(), and write_space_outliner().
| void void void void void BLI_mempool_set_memory_debug | ( | void | ) |
Definition at line 769 of file BLI_mempool.c.
References mempool_debug_memset.
Referenced by arg_handle_debug_mode_set().