Blender V5.0
BLI_memarena.h File Reference
#include <cstddef>
#include "BLI_compiler_attrs.h"
#include "MEM_guardedalloc.h"

Go to the source code of this file.

Macros

#define BLI_MEMARENA_STD_BUFSIZE   MEM_SIZE_OPTIMAL(1 << 14)

Functions

MemArenaBLI_memarena_new (size_t bufsize, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(2) ATTR_MALLOC
void BLI_memarena_free (MemArena *ma) ATTR_NONNULL(1)
void BLI_memarena_use_malloc (MemArena *ma) ATTR_NONNULL(1)
void BLI_memarena_use_calloc (MemArena *ma) ATTR_NONNULL(1)
void BLI_memarena_use_align (MemArena *ma, size_t align) ATTR_NONNULL(1)
void * BLI_memarena_alloc (MemArena *ma, size_t size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_ALLOC_SIZE(2)
void * BLI_memarena_calloc (MemArena *ma, size_t size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_ALLOC_SIZE(2)
template<typename T>
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL (1) ATTR_MALLOC T *BLI_memarena_alloc(MemArena *ma
 Iterator Init.
void BLI_memarena_clear (MemArena *ma) ATTR_NONNULL(1)

Variables

ATTR_WARN_UNUSED_RESULT const size_t num

Macro Definition Documentation

◆ BLI_MEMARENA_STD_BUFSIZE

Function Documentation

◆ ATTR_NONNULL()

template<typename T>
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL ( 1 )

Iterator Init.

Iterator New.

C++ templates for convenience.

Takes a bmesh iterator structure and fills it with the appropriate function pointers based upon its type.

Takes a bmesh iterator structure and fills it with the appropriate function pointers based upon its type and then calls BMeshIter_step() to return the first element of the iterator.

Tests whether or not the edge is part of a wire. (ie: has no faces attached to it)

Tests whether or not this edge is manifold. A manifold edge has exactly 2 faces attached to it.

Tests that the edge is manifold and that both its faces point the same way.

Tests whether or not an edge is on the boundary of a shell (has one face associated with it)

Check if we have a single wire edge user.

Definition at line 66 of file bmesh_query_inline.hh.

References ATTR_WARN_UNUSED_RESULT, BLI_INLINE, BM_edge_is_wire(), and e.

◆ BLI_memarena_alloc()

void * BLI_memarena_alloc ( MemArena * ma,
size_t size )

Definition at line 118 of file BLI_memarena.cc.

References MemArena::align, BLI_asan_poison, BLI_asan_unpoison, MemArena::bufs, MemArena::bufsize, MemArena::curbuf, MemArena::cursize, MemBuf::data, MEM_callocN(), MEM_mallocN(), memarena_curbuf_align(), MemArena::name, MemBuf::next, PADUP, ptr, size(), UNLIKELY, MemArena::use_calloc, and VALGRIND_MEMPOOL_ALLOC.

Referenced by _bmo_slot_buffer_append(), _bmo_slot_copy(), add_cube(), add_member(), add_new_bound_vert(), blender::geometry::PackIsland::add_polygon(), add_type(), addfillface(), bevel_build_cutoff(), bevel_vert_construct(), BKE_lnor_spacearr_init(), BKE_mesh_loop_islands_add(), BKE_mesh_loop_islands_init(), BKE_mesh_remap_init(), BLI_astar_node_link_add(), BLI_astar_solution_init(), BLI_linklist_append_arena(), BLI_linklist_prepend_arena(), BLI_memarena_calloc(), BLI_polyfill_beautify(), BLI_polyfill_calc_arena(), BLI_scanfill_edge_add(), BLI_scanfill_vert_add(), blo_cache_storage_entry_register(), bm_face_split_by_edges_island_connect(), BM_face_split_edgenet_connect_islands(), bm_interp_face_store(), bm_isect_edge_tri(), BM_vert_loop_groups_data_layer_create(), bmesh_calc_tessellation_for_face_beauty(), bmesh_calc_tessellation_for_face_impl(), bmo_face_inset_individual(), bmo_inset_region_exec(), BMO_slot_buffer_alloc(), BMO_slot_buffer_from_array(), BMO_slot_buffer_from_single(), BMO_slot_mat_set(), build_bvh_spatial(), build_vmesh(), C_BVHTree_FromPolygons(), calculate_profile(), DNA_member_id_rename(), dynstr_alloc(), blender::geometry::PackIsland::finalize_geometry_(), ghash_insert_face_edge_link(), ghash_insert_link(), init_meta(), insert_seam_vert_array(), knife_empty_list(), math_layer_info_init(), blender::bke::mesh::mesh_calc_tessellation_for_face_impl(), blender::ed::transform::mesh_customdatacorrect_init_container_merge_group(), blender::ed::transform::mesh_customdatacorrect_init_vert(), mesh_remap_item_define(), mesh_tessface_calc(), meshdeform_matrix_solve(), meshdeform_ray_tree_intersect(), new_adj_vmesh(), blender::geometry::new_geo_uv_pinindex(), blender::geometry::p_add_ngon(), blender::geometry::p_face_add(), blender::geometry::p_vert_add(), blender::geometry::p_vert_copy(), blender::bke::pbvh::pbvh_bmesh_node_limit_ensure_fast(), project_paint_build_proj_ima(), project_paint_op(), project_paint_uvpixel_init(), register_uv_face(), sdna_expand_names(), set_profile_spacing(), setcenter(), setcorner(), setedge(), UI_view2d_text_cache_add(), UI_view2d_text_cache_add_rectf(), and blender::bke::greasepencil::update_triangle_cache().

◆ BLI_memarena_calloc()

◆ BLI_memarena_clear()

◆ BLI_memarena_free()

void BLI_memarena_free ( MemArena * ma)

Definition at line 96 of file BLI_memarena.cc.

References MemArena::bufs, MEM_freeN(), memarena_buf_free_all(), and VALGRIND_DESTROY_MEMPOOL.

Referenced by BKE_displist_fill(), BKE_library_make_local(), BKE_lnor_spacearr_free(), BKE_lnor_spacearr_tls_join(), BKE_maskrasterize_handle_init(), BKE_mesh_loop_islands_free(), BKE_mesh_remap_free(), BLI_astar_graph_free(), BLI_astar_solution_free(), BLI_dynstr_free(), BLI_polyfill_calc(), BLI_scanfill_end(), blo_cache_storage_end(), bm_decim_triangulate_begin(), BM_mesh_bevel(), bm_mesh_calc_tessellation__single_threaded(), BM_mesh_calc_tessellation_beauty(), bm_mesh_calc_tessellation_with_partial__single_threaded(), BM_mesh_intersect(), BM_mesh_triangulate(), bmesh_calc_tessellation_for_face_free_fn(), bmesh_calc_tessellation_for_face_partial_free_fn(), bmo_connect_verts_concave_exec(), bmo_inset_individual_exec(), bmo_inset_region_exec(), BMO_op_finish(), C_BVHTree_FromPolygons(), blender::geometry::ngon::calc_corner_tris(), LibOverrideGroupTagData::clear(), DNA_sdna_free(), do_projectpaint_thread(), edbm_face_split_by_edges_exec(), blender::geometry::finalize_geometry(), freepolygonize(), harmonic_coordinates_bind(), knifetool_exit_ex(), layer_bucket_init(), make_structDNA(), blender::ed::transform::mesh_customdatacorrect_free(), mesh_tessface_calc(), project_paint_end(), smart_project_exec(), test_polyfill_template(), UI_view2d_text_cache_draw(), blender::bke::greasepencil::update_triangle_cache(), uv_select_overlap(), uvedit_pack_islands_multi(), blender::bke::mesh::LocalData::~LocalData(), and blender::geometry::ParamHandle::~ParamHandle().

◆ BLI_memarena_new()

MemArena * BLI_memarena_new ( size_t bufsize,
const char * name )

Definition at line 66 of file BLI_memarena.cc.

References MemArena::align, MemArena::bufsize, MEM_callocN(), MemArena::name, name, and VALGRIND_CREATE_MEMPOOL.

Referenced by BKE_displist_fill(), BKE_library_make_local(), BKE_lnor_spacearr_init(), BKE_lnor_spacearr_tls_init(), BKE_maskrasterize_handle_init(), BKE_mball_polygonize(), BKE_mesh_loop_islands_init(), BKE_mesh_remap_init(), BLI_astar_graph_init(), BLI_astar_solution_init(), BLI_dynstr_new_memarena(), BLI_polyfill_calc(), BLI_scanfill_begin(), blo_cache_storage_init(), bm_decim_triangulate_begin(), BM_mesh_bevel(), BM_mesh_intersect(), BM_mesh_triangulate(), bmesh_calc_tessellation_for_face_beauty(), bmesh_calc_tessellation_for_face_impl(), bmo_connect_verts_concave_exec(), bmo_inset_individual_exec(), bmo_inset_region_exec(), BMO_op_init(), C_BVHTree_FromPolygons(), blender::geometry::ngon::calc_corner_tris(), DNA_sdna_alias_data_ensure(), DNA_sdna_patch_struct_member(), do_projectpaint_thread(), edbm_face_split_by_edges_exec(), blender::geometry::finalize_geometry(), blender::bke::pbvh::Tree::from_bmesh(), harmonic_coordinates_bind(), knifetool_init(), layer_bucket_init(), lib_override_group_tag_data_object_to_collection_init(), make_structDNA(), blender::bke::mesh::mesh_calc_tessellation_for_face_impl(), blender::ed::transform::mesh_customdatacorrect_create_impl(), mesh_tessface_calc(), blender::geometry::ParamHandle::ParamHandle(), proj_paint_state_thread_init(), smart_project_exec(), test_polyfill_template(), UI_view2d_text_cache_add(), UI_view2d_text_cache_add_rectf(), blender::bke::greasepencil::update_triangle_cache(), uv_select_overlap(), and uvedit_pack_islands_multi().

◆ BLI_memarena_use_align()

void BLI_memarena_use_align ( MemArena * ma,
size_t align )

Definition at line 88 of file BLI_memarena.cc.

References MemArena::align, and BLI_assert.

◆ BLI_memarena_use_calloc()

void BLI_memarena_use_calloc ( MemArena * ma)

Definition at line 78 of file BLI_memarena.cc.

References MemArena::use_calloc.

Referenced by BM_mesh_bevel(), BMO_op_init(), and harmonic_coordinates_bind().

◆ BLI_memarena_use_malloc()

void BLI_memarena_use_malloc ( MemArena * ma)

Definition at line 83 of file BLI_memarena.cc.

References MemArena::use_calloc.

Variable Documentation

◆ num

ATTR_WARN_UNUSED_RESULT const size_t num
Initial value:
= 1)
{
static_assert(std::is_trivial_v<T>,
"Only trivial types may be allocated with BLI_memarena_alloc");
return static_cast<T *>(BLI_memarena_alloc(ma, sizeof(T) * num));
}
template<typename T>
const size_t num = 1)
{
static_assert(std::is_trivial_v<T>,
"Only trivial types may be allocated with BLI_memarena_calloc");
return static_cast<T *>(BLI_memarena_calloc(ma, sizeof(T) * num));
}
void BLI_memarena_merge(MemArena *ma_dst, MemArena *ma_src) ATTR_NONNULL(1, 2)
#define ATTR_WARN_UNUSED_RESULT
#define ATTR_MALLOC
#define ATTR_NONNULL(...)
void BLI_memarena_merge(MemArena *ma_dst, MemArena *ma_src)
void * BLI_memarena_calloc(MemArena *ma, size_t size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_ALLOC_SIZE(2)
void * BLI_memarena_alloc(MemArena *ma, size_t size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_ALLOC_SIZE(2)
ATTR_WARN_UNUSED_RESULT const size_t num
#define T

Definition at line 42 of file BLI_memarena.h.

Referenced by device_only_memory< T >::alloc_to_device(), blender::animrig::array_shift_range(), blender::ed::object::bake_simulation::bake_geometry_nodes_startjob(), BKE_collision_objects_create(), BLI_cpu_support_sse42(), BLI_jitter_init(), BLI_jitterate1(), BLI_jitterate2(), BLI_str_format_int64_grouped(), BLI_str_format_int_grouped(), BLI_str_format_uint64_grouped(), BLI_str_unescape(), BLI_system_num_threads_override_set(), BLO_write_char_array(), BLO_write_double_array(), BLO_write_float3_array(), BLO_write_float_array(), BLO_write_int16_array(), BLO_write_int32_array(), BLO_write_int8_array(), BLO_write_pointer_array(), BLO_write_uint32_array(), BLO_write_uint8_array(), bm_face_split_walk_back(), brush_add(), brush_add_count_iter(), buildAdjacencyMap(), BVHBuild::BVHObjectBinning, blender::ed::curves::pen_tool::calculate_center_of_mass(), blender::ed::object::convert_float_color_to_byte_color(), count_curve_segments(), count_outputs(), cpu_supports_sse42(), BVHBuild::create_leaf_node(), BVHBuild::create_object_leaf_nodes(), data_transfer_layersmapping_cdlayers(), data_transfer_layersmapping_vgroups(), device_cuda_capabilities(), device_cuda_info(), device_hip_capabilities(), device_hip_info(), dynamicPaint_symmetrizeAdjData(), dynstr_alloc(), Attribute::get_uv_tiles(), btGearConstraint::getParam(), getParam(), getParam(), GPU_constant(), GPU_uniform(), blender::animrig::grow_array(), grow_array(), blender::animrig::grow_array_and_append(), blender::animrig::grow_array_and_insert(), IK_QPositionTask::IK_QPositionTask(), IMB_rectfill(), init_mv_jit(), blender::draw::interpolate(), blender::draw::interpolate(), Freestyle::GeomUtils::intersect2dLine2dLine(), Freestyle::GeomUtils::intersect2dSeg2dSeg(), Freestyle::GeomUtils::intersect2dSeg2dSegParametric(), blender::nodes::node_geo_input_mesh_face_neighbors_cc::large_enough_total_size(), mathutils_array_parse(), mathutils_array_parse_alloc(), mathutils_array_parse_alloc_v(), blender::ed::object::object_hook_assign_exec(), blender::ed::object::object_hook_from_context(), blender::ed::object::object_hook_recenter_exec(), blender::ed::object::object_hook_remove_exec(), blender::ed::object::object_hook_reset_exec(), blender::ed::object::object_hook_select_exec(), blender::draw::particle_calculate_parent_mcol(), blender::draw::particle_calculate_parent_uvs(), blender::draw::particle_interpolate_children_mcol(), blender::draw::particle_interpolate_children_uvs(), blender::ed::vse::pixels_to_display_space(), blender::ed::vse::pixels_to_display_space(), psys_get_dupli_texture(), ptcache_frame_from_filename(), btSoftBody::RayFromToCaster::rayFromToTriangle(), RB_body_get_activation_state(), RB_trimesh_add_triangle_indices(), read_file_dna(), blender::ed::transform::curves::recent_position_offsets(), rna_float_print(), rna_int_print(), RNA_property_collection_skip(), RNA_property_pointer_get_default(), sequence_guess_offset(), btMLCPSolver::setNumFallbacks(), btMultiBodyMLCPConstraintSolver::setNumFallbacks(), btGearConstraint::setParam(), setParam(), setParam(), blender::animrig::shrink_array(), shrink_array(), blender::animrig::shrink_array_and_remove(), blender::animrig::shrink_array_and_swap_remove(), smaller_power_of_2_limit(), sortPolyVertsEdge(), sortPolyVertsTri(), SphericalRangeParameters(), string_human_readable_number(), blender::TEST(), blender::TEST(), tex_input(), triangle_light_sample(), txt_select_prefix(), txt_select_unprefix(), ui_do_but_text_value_cycle(), blender::ed::space_node::ui_node_menu_column(), blender::geometry::valid_int_num(), weightvg_do_map(), weightvg_do_mask(), weightvg_update_vg(), wm_history_file_read(), wm_save_as_mainfile_exec(), and blender::io::hydra::HairData::write_curves().