BRL-CAD
Allocation & Deallocation
Collaboration diagram for Allocation & Deallocation:

Files

file  malloc.c
 Parallel-protected debugging-enhanced wrapper around system malloc().
 

Macros

#define BU_GET(_ptr, _type)   _ptr = (_type *)bu_calloc(1, sizeof(_type), #_type " (BU_GET) " BU_FLSTR)
 
#define BU_PUT(_ptr, _type)   do { *(uint8_t *)(_type *)(_ptr) = /*zap*/ 0; bu_free(_ptr, #_type " (BU_PUT) " BU_FLSTR); _ptr = NULL; } while (0)
 
#define BU_ALLOC(_ptr, _type)   _ptr = (_type *)bu_calloc(1, sizeof(_type), #_type " (BU_ALLOC) " BU_FLSTR)
 
#define BU_FREE(_ptr, _type)   do { bu_free(_ptr, #_type " (BU_FREE) " BU_FLSTR); _ptr = (_type *)NULL; } while (0)
 

Typedefs

typedef int(* bu_heap_func_t) (const char *,...)
 

Functions

void * bu_malloc (size_t siz, const char *str)
 
void * bu_calloc (size_t nelem, size_t elsize, const char *str)
 
void bu_free (void *ptr, const char *str)
 
void * bu_realloc (void *ptr, size_t siz, const char *str)
 
void bu_prmem (const char *str)
 
int bu_malloc_len_roundup (int nbytes)
 
void bu_ck_malloc_ptr (void *ptr, const char *str)
 
int bu_mem_barriercheck (void)
 
void * bu_heap_get (size_t sz)
 
void bu_heap_put (void *ptr, size_t sz)
 
bu_heap_func_t bu_heap_log (bu_heap_func_t log)
 
int bu_shmget (int *shmid, char **shared_memory, int key, size_t size)
 

Variables

long bu_n_malloc
 
long bu_n_realloc
 

Detailed Description

Macro Definition Documentation

#define BU_GET (   _ptr,
  _type 
)    _ptr = (_type *)bu_calloc(1, sizeof(_type), #_type " (BU_GET) " BU_FLSTR)

Fast dynamic memory allocation macro for small pointer allocations. Memory is automatically initialized to zero and, similar to bu_calloc(), is guaranteed to return non-NULL (or bu_bomb()).

Memory acquired with BU_GET() should be returned with BU_PUT(), NOT with bu_free().

Use BU_ALLOC() for dynamically allocating structures that are relatively large, infrequently allocated, or otherwise don't need to be fast.

Definition at line 201 of file malloc.h.

Referenced by _ged_add_metaballpt(), _ged_add_pipept(), _ged_ins_pipept(), _ged_run_rt(), _ged_run_rtwizard(), air_setup(), apply_filter_obj(), bbd_setup(), bn_3d_chull(), bottie_prep_double(), brdf_setup(), bu_hook_add(), cglass_setup(), cho_open(), chull3d_data_init(), chull3d_intermediate_set(), ckr_setup(), cloud_setup(), cmirror_setup(), cook_setup(), db_diff(), db_diff3(), db_diff3_dp(), db_diff_dp(), diff3_dp_attr_add(), diff3_dp_attr_chgd(), diff3_dp_attr_conflict(), diff3_dp_attr_del(), diff3_dp_attr_unchgd(), diff_dp_attr_add(), diff_dp_attr_chgd(), diff_dp_attr_del(), diff_dp_attr_unchgd(), diff_init_result(), dm_get(), dm_list_types(), fb_get(), fbm_setup(), find_subbreps(), fire_setup(), flat_setup(), gauss_setup(), gcv_plugin_register(), ged_init(), ged_open(), ged_push(), ged_rmap(), ged_rtcheck(), ged_which(), get_diff_components(), GetMaterial(), glass_setup(), grass_setup(), hyp_internal_to_specific(), light_maker(), main(), mirror_setup(), nmg_radial_build_list(), noise_setup(), obj_vlist(), observer_attach(), osl_setup(), palloc(), phong_setup(), pipe_scale_radius(), points_setup(), prj_setup(), qt_get_fbps(), rt_bend_pipe_prep(), rt_cline_prep(), rt_dsp_prep(), rt_ebm_prep(), rt_ehy_prep(), rt_ell_prep(), rt_epa_prep(), rt_eto_prep(), rt_extrude_prep(), rt_grp_prep(), rt_hf_prep(), rt_hlf_prep(), rt_hrt_prep(), rt_joint_find_selections(), rt_joint_prep(), rt_linear_pipe_prep(), rt_metaball_add_point(), rt_metaball_import5(), rt_nmg_prep(), rt_nurb_bbox(), rt_nurb_prep(), rt_part_prep(), rt_pgface(), rt_pipe_prep(), rt_rec_prep(), rt_revolve_prep(), rt_rhc_prep(), rt_rpc_prep(), rt_sph_prep(), rt_submodel_prep(), rt_superell_prep(), rt_tgc_prep(), rt_tor_prep(), rt_vol_prep(), rtrans_setup(), scloud_setup(), setup(), sh_stk_setup(), spm_setup(), stxt_setup(), subbrep_object_init(), subbrep_split(), tcl_setup(), temp_add_to_list(), temp_setup(), tglass_setup(), tmirror_setup(), to_mouse_otranslate(), toon_setup(), toyota_setup(), tthrm_setup(), txt_setup(), vo_open_cmd(), wood_setup(), XGLUE(), and xxx_setup().

#define BU_PUT (   _ptr,
  _type 
)    do { *(uint8_t *)(_type *)(_ptr) = /*zap*/ 0; bu_free(_ptr, #_type " (BU_PUT) " BU_FLSTR); _ptr = NULL; } while (0)

Handy dynamic memory deallocator macro. Deallocated memory has the first byte zero'd for sanity (and potential early detection of double-free crashing code) and the pointer is set to NULL.

Memory acquired with bu_malloc()/bu_calloc() should be returned with bu_free(), NOT with BU_PUT().

Definition at line 215 of file malloc.h.

Referenced by _ged_add_pipept(), _ged_delete_metaballpt(), _ged_delete_pipept(), _ged_ins_pipept(), _ged_rt_output_handler(), air_free(), apply_filter_obj(), bbd_free(), bn_3d_chull(), brdf_free(), brdf_setup(), bu_hook_delete(), bu_hook_delete_all(), bu_observer_free(), camo_free(), cho_deleteProc(), chull3d_data_free(), chull3d_intermediate_set(), ckr_free(), ckr_setup(), cloud_free(), cook_free(), cook_setup(), db_diff(), db_diff3(), db_diff3_dp(), db_diff_dp(), db_search_free_plan(), diff_free_result(), dm_list_tcl(), dm_put(), fb_put(), fbm_free(), fire_free(), flat_free(), free_diff_components(), free_path_edit_params_entry(), full_region_node(), gauss_free(), gcv_plugin_free(), ged_free(), ged_push(), ged_rmap(), ged_which(), get_diff_components(), GetMaterial(), glass_setup(), grass_free(), main(), mirror_setup(), nmg_radial_join_eu_NEW(), nmg_s_radial_harmonize(), noise_free(), observer_detach(), osl_free(), phong_free(), phong_setup(), pipe_elements_free(), pipe_scale_radius(), points_setup(), prj_free(), qt_put_fbps(), rt_bend_pipe_prep(), rt_cline_free(), rt_dsp_free(), rt_ebm_free(), rt_ehy_free(), rt_ell_free(), rt_epa_free(), rt_eto_free(), rt_extrude_free(), rt_grp_free(), rt_hf_free(), rt_hf_prep(), rt_hlf_free(), rt_hrt_free(), rt_hyp_free(), rt_hyp_plot(), rt_hyp_tess(), rt_joint_free(), rt_metaball_ifree(), rt_nmg_free(), rt_nurb_bbox(), rt_nurb_free(), rt_part_free(), rt_pg_free(), rt_pgface(), rt_pipe_adaptive_plot(), rt_pipe_free(), rt_pipe_plot(), rt_rec_free(), rt_revolve_free(), rt_rhc_free(), rt_rpc_free(), rt_sph_free(), rt_submodel_free(), rt_superell_free(), rt_tgc_free(), rt_tor_free(), rt_vol_free(), rtrans_free(), scloud_free(), sh_stk_free(), solid_node(), spm_mfree(), spm_setup(), stxt_free(), stxt_setup(), subbrep_object_free(), subbrep_split(), tcl_free(), temp_close_files(), temp_free(), temp_setup(), to_deleteProc(), toon_free(), toyota_free(), toyota_setup(), tthrm_free(), txt_free(), txt_setup(), wood_free(), wood_setup(), XGLUE(), and xxx_free().

#define BU_ALLOC (   _ptr,
  _type 
)    _ptr = (_type *)bu_calloc(1, sizeof(_type), #_type " (BU_ALLOC) " BU_FLSTR)

Convenience macro for allocating a single structure on the heap. Not intended for performance-critical code. Release memory acquired with bu_free() or BU_FREE() to dealloc and set NULL.

Definition at line 223 of file malloc.h.

Referenced by _db_search_full_paths(), _gcv_cleanup(), _ged_combadd2(), _ged_results_init(), _ged_search_localized_obj_list(), _rt_find_identical_solid(), _rt_gettree_region_end(), add_operand(), add_solid(), add_unique_pair(), Add_vert(), Add_vert_and_norm(), append_inter(), append_lparen(), append_rparen(), append_subtr(), append_union(), approximate_hyperbolic_curve(), approximate_parabolic_curve(), bezier_roots(), bezier_subdivide(), bn_gauss_init(), bn_mat_dup(), bn_multipoly_new(), bn_randmt_state_create(), bn_spm_init(), bn_unif_init(), bn_vlblock_init(), bot2soup(), bottie_allocn_double(), bottie_allocn_float(), brep_conversion(), brep_conversion_comb(), brep_conversion_tree(), bu_avs_new(), bu_list_new(), bu_open_mapped_file(), bu_rb_create(), bu_rb_insert(), bu_units_strings_vls(), bu_vls_vlsinit(), build_comb(), build_etree(), buildEdgeTable(), BuildPhotonMap(), BuildTree(), bw_read(), check_hitstate(), classify_seg(), cmdhist_record(), combmem_set(), combmem_set_arb_rot(), combmem_set_rot(), combmem_set_sca(), combmem_set_tra(), create_vert_tree(), create_vert_tree_w_norms(), db_argv_to_dpv(), db_dup_combined_tree_state(), db_full_path_list_add(), db_fullpath_list_subtree(), db_lookup_by_attr(), db_new_combined_tree_state(), db_open(), db_open_inmem(), db_parse_1anim(), db_search(), db_search_unique_objects(), dl_addToDisplay(), dmo_open_tcl(), do_inter(), do_region_end(), do_union_subtr(), dup_bot(), edit_arg_duplicate(), edit_arg_duplicate_in_place(), edit_arg_postfix_new(), edit_arg_to_coord(), edit_str_to_arg(), Eplot(), eval_etree(), f_print(), fbo_open_tcl(), fix_halfs(), ged_3ptarb(), ged_arb(), ged_bb(), ged_bev(), ged_bot_merge(), ged_brep(), ged_cc(), ged_coil(), ged_color(), ged_comb_std(), ged_E(), ged_edit(), ged_export_polygon(), ged_get_object_selections(), ged_get_selection_set(), ged_import_polygon(), ged_make(), ged_make_pnts(), ged_nirt(), ged_nmg_simplify(), ged_open(), ged_put_comb(), ged_red(), ged_rfarb(), ged_search(), get_obj_data(), get_tcl_curve(), getRegionByName(), icv_create(), img_load_datasource(), Initialize(), insert_above(), insert_node(), Irradiance(), isect_ray_snurb_face(), light_setup(), main(), make_ellipse(), make_ellipse4(), make_hole(), make_hole_in_prepped_regions(), mesh_leaf(), mk_add_pipe_pt(), mk_addmember(), mk_arb8(), mk_arbn(), mk_ars(), mk_binunif(), mk_bot_w_normals(), mk_brep(), mk_bspline(), mk_cline(), mk_comb(), mk_constraint(), mk_dsp(), mk_ebm(), mk_ehy(), mk_ell(), mk_epa(), mk_eto(), mk_extrusion(), mk_grip(), mk_half(), mk_hrt(), mk_hyp(), mk_metaball(), mk_particle(), mk_pipe(), mk_rhc(), mk_rpc(), mk_sph(), mk_submodel(), mk_tgc(), mk_tor(), mk_tree_gift(), mk_tree_pure(), mk_vol(), new_cv_selection(), new_image(), nmg_bot(), nmg_build_loopuse_tree(), nmg_eval_linear_trim_to_tol(), nmg_eval_trim_to_tol(), nmg_find_outer_and_void_shells(), nmg_flatten_face(), nmg_get_edge_lines(), nmg_region_end(), nmg_split_linear_trim(), nmg_split_trim(), null_open(), pix_read(), plot_open(), points_setup(), ppm_read(), print_path_with_bools(), ps_open(), ReadArgs(), rt_advance_to_next_cell(), rt_arb_brep(), rt_arb_import4(), rt_arb_import5(), rt_arbn_brep(), rt_arbn_import4(), rt_arbn_import5(), rt_ars_brep(), rt_ars_import4(), rt_ars_import5(), rt_binunif_import5_minor_type(), rt_binunif_make(), rt_bot_brep(), rt_bot_create(), rt_bot_import4(), rt_bot_import5(), rt_bot_patches(), rt_bot_split(), rt_bot_xform(), rt_bound_internal(), rt_brep_boolean(), rt_brep_find_selections(), rt_brep_import5(), rt_brep_prep(), rt_cline_brep(), rt_cline_import4(), rt_cline_import5(), rt_cline_to_pipe(), rt_color_addrec(), rt_comb_import4(), rt_comb_import5(), rt_comb_make(), rt_copy_curve(), rt_copy_sketch(), rt_cut_it(), rt_cut_one_axis(), rt_dsp_import4(), rt_dsp_import5(), rt_dsp_make(), rt_dup_material_head(), rt_ebm_brep(), rt_ebm_import4(), rt_ebm_import5(), rt_ebm_make(), rt_ehy_import4(), rt_ehy_import5(), rt_ehy_plot(), rt_ehy_tess(), rt_ell_import4(), rt_ell_import5(), rt_epa_import4(), rt_epa_import5(), rt_epa_plot(), rt_epa_tess(), rt_eto_import4(), rt_eto_import5(), rt_extrude_brep(), rt_extrude_import4(), rt_extrude_import5(), rt_extrude_tess(), rt_extrude_xform(), rt_find_paths(), rt_gen_conic(), rt_gen_elliptical_grid(), rt_gen_frustum(), rt_gen_rect(), rt_gettrees_muves(), rt_grp_import4(), rt_grp_import5(), rt_hf_import4(), rt_hf_to_dsp(), rt_hlf_import4(), rt_hlf_import5(), rt_hlf_xform(), rt_hrt_import5(), rt_hrt_plot(), rt_hyp_import5(), rt_hyp_tess(), rt_insert_color(), rt_joint_find_selections(), rt_joint_import5(), rt_joint_process_selection(), rt_memfree(), rt_metaball_import5(), rt_metaball_prep(), rt_mk_binunif(), rt_mk_hyperbola(), rt_mk_parabola(), rt_new_rti(), rt_nurb_import4(), rt_nurb_import5(), rt_nurb_mk_poly(), rt_part_import4(), rt_part_import5(), rt_pg_brep(), rt_pg_import4(), rt_pg_to_bot(), rt_pipe_adjust(), rt_pipe_import4(), rt_pipe_import5(), rt_pnts_import5(), rt_revolve_brep(), rt_revolve_import5(), rt_revolve_make(), rt_revolve_xform(), rt_rhc_import4(), rt_rhc_import5(), rt_rhc_plot(), rt_rhc_tess(), rt_rpc_import4(), rt_rpc_import5(), rt_rpc_plot(), rt_rpc_tess(), rt_shootray(), rt_shootray_bundle(), rt_shootrays(), rt_sketch_import4(), rt_sketch_import5(), rt_submodel_import4(), rt_submodel_import5(), rt_submodel_prep(), rt_submodel_shot(), rt_superell_brep(), rt_superell_import4(), rt_superell_import5(), rt_tgc_import4(), rt_tgc_import5(), rt_tol_default(), rt_tor_import4(), rt_tor_import5(), rt_unprep(), rt_vol_brep(), rt_vol_import4(), rt_vol_import5(), rt_vshootray(), rt_xxx_import5(), seg_to_vlist(), sh_stk_setup(), shoot_and_plot(), to_new_view(), to_open_tcl(), to_rt_gettrees_application(), txt_load_datasource(), txt_open(), vfont_get(), and wdb_dbopen().

#define BU_FREE (   _ptr,
  _type 
)    do { bu_free(_ptr, #_type " (BU_FREE) " BU_FLSTR); _ptr = (_type *)NULL; } while (0)

Convenience macro for deallocating a single structure allocated on the heap (with bu_malloc(), bu_calloc(), BU_ALLOC()).

Definition at line 229 of file malloc.h.

Referenced by joint_selection(), and voxelize().

Typedef Documentation

typedef int(* bu_heap_func_t) (const char *,...)

Convenience typedef for the printf()-style callback function used during application exit to print summary statistics.

Definition at line 166 of file malloc.h.

Function Documentation

void* bu_malloc ( size_t  siz,
const char *  str 
)

This routine only returns on successful allocation. We promise never to return a NULL pointer; caller doesn't have to check. Allocation failure results in bu_bomb() being called.

Definition at line 314 of file malloc.c.

References alloc(), and MALLOC.

Referenced by _ged_dir_getspace(), _ged_drawtrees(), _ged_search_localized_obj_list(), _rt_find_identical_solid(), Add_face(), add_operand(), ars_rd_curve(), binterp(), bn_3d_coplanar_chull(), bn_gauss_init(), bn_multipoly_grow(), bn_multipoly_new(), bn_spm_init(), bn_spm_pix_load(), bn_tabdata_binary_read(), bn_unif_init(), bot2soup(), bottie_prep_double(), brep_conversion_tree(), bu_avs_add_nonunique(), bu_bitv_new(), bu_copy_external(), bu_cv_w_cookie(), bu_heap_get(), bu_rb_create(), bu_rb_create1(), bu_rb_delete(), bu_rb_insert(), bu_realloc(), bu_scan_fastf_t(), bu_strdupm(), bu_struct_export(), bu_struct_get(), bu_vls_extend(), bu_vls_strdup(), build_vertex_tree(), BuildPhotonMap(), bw_read(), control_polygon_flat_enough(), create_vert_tree(), create_vert_tree_w_norms(), RT_MemoryArchive::CreateCopy(), data2uchar(), db5_export_object3(), db5_get_raw_internal_fp(), db5_realloc(), db_add_node_to_full_path(), db_alloc(), db_argv_to_dpv(), db_argv_to_path(), db_dpv_to_argv(), db_dup_db_tree_state(), db_dup_full_path(), db_dup_path_tail(), db_extend_full_path(), db_get_external(), db_getmrec(), db_ls(), db_open(), db_path_to_string(), db_string_to_path(), db_zapper(), dmo_open_tcl(), do_quad(), do_tri(), dsp_layers(), edit_translate(), fb_set_name(), find_closest_face(), FindLoops(), gcv_fastgen4_read(), ged_draw_guts(), ged_edcodes(), ged_edmater(), ged_lc(), ged_make(), ged_search(), ged_track2(), get_densities_from_database(), get_densities_from_file(), get_file_data(), icv_create(), icv_crop(), icv_filter(), icv_filter3(), icv_gray2rgb(), icv_init_bins(), icv_max(), icv_median(), icv_min(), icv_mode(), icv_rect(), icv_rgb2gray(), icv_rot(), icv_skew(), icv_sum(), icv_var(), image_flip(), lex_getone(), main(), make_ellipse(), make_model_from_face(), mk_arbn(), ninterp(), nmg_cnurb_to_vlist(), nmg_face_coincident_vu_sort(), nmg_find_outer_and_void_shells(), nmg_isect2d_prep(), nmg_open_shells_connect(), nmg_translate_face(), ON_Intersect(), pix_read(), ppm_read(), pull_comb(), rt_alloc_seg_block(), rt_arb_export4(), rt_arb_export5(), rt_arb_setup(), rt_arbn_export4(), rt_arbn_export5(), rt_arbn_import4(), rt_arbn_import5(), rt_arbn_prep(), rt_ars_adjust(), rt_ars_import4(), rt_binunif_adjust(), rt_binunif_export5(), rt_binunif_import5_minor_type(), rt_bot_adjust(), rt_bot_decimate(), rt_bot_export5(), rt_bot_sort_faces(), rt_bot_xform(), rt_cline_export5(), rt_comb_import5(), rt_copy_curve(), rt_dsp_export5(), rt_ehy_export5(), rt_ehy_plot(), rt_ehy_tess(), rt_ell_export5(), rt_epa_export5(), rt_epa_plot(), rt_epa_tess(), rt_eto_export5(), rt_eto_plot(), rt_eto_tess(), rt_grow_boolstack(), rt_grp_export5(), rt_hf_import4(), rt_hlf_export5(), rt_hrt_export5(), rt_hrt_plot(), rt_hrt_vshot(), rt_hyp_tess(), rt_joint_export5(), rt_metaball_export5(), rt_metaball_import5(), rt_mk_binunif(), rt_nmg_brep(), rt_nmg_export4_fastf(), rt_nmg_import4_fastf(), rt_nurb_c_eval(), rt_nurb_c_split(), rt_nurb_c_xsplit(), rt_nurb_calc_oslo(), rt_nurb_cinterp(), rt_nurb_doolittle(), rt_nurb_export5(), rt_nurb_gen_knot_vector(), rt_nurb_import4(), rt_nurb_import5(), rt_nurb_intersect(), rt_nurb_kvcopy(), rt_nurb_kvextract(), rt_nurb_kvgen(), rt_nurb_kvknot(), rt_nurb_kvmerge(), rt_nurb_kvmult(), rt_nurb_new_cnurb(), rt_nurb_new_snurb(), rt_nurb_reverse_srf(), rt_nurb_s_eval(), rt_nurb_s_flat(), rt_nurb_s_refine(), rt_nurb_s_split(), rt_nurb_s_xsplit(), rt_nurb_sinterp(), rt_nurb_solve(), rt_part_export5(), rt_pg_import4(), rt_pg_tess(), rt_pipe_export5(), rt_pipe_import5(), rt_pr_tree_str(), rt_read_cmd(), rt_rhc_export5(), rt_rhc_plot(), rt_rhc_tess(), rt_rpc_export5(), rt_rpc_plot(), rt_rpc_tess(), rt_sketch_export4(), rt_sketch_export5(), rt_sketch_import4(), rt_sketch_import5(), rt_superell_export5(), rt_tgc_adaptive_plot(), rt_tgc_export5(), rt_tgc_tess(), rt_tgc_vshot(), rt_tor_export5(), rt_tor_plot(), rt_tor_tess(), rt_tor_vshot(), seg_to_vlist(), shrink_image(), stxt_read(), to_new_view(), toyota_setup(), triangulateFace(), uchar2double(), vfont_get(), wdb_importFg4Section_cmd(), and XGLUE().

Here is the call graph for this function:

void* bu_calloc ( size_t  nelem,
size_t  elsize,
const char *  str 
)

This routine only returns on successful allocation. We promise never to return a NULL pointer; caller doesn't have to check. Failure results in bu_bomb() being called.

Definition at line 321 of file malloc.c.

References alloc(), and CALLOC.

Referenced by _ged_build_dpp(), _ged_combadd2(), _ged_editit(), _ged_find_matrix(), _ged_getspace(), _ged_print_node(), _path_scrub(), _rt_getregion(), _rt_gettree_region_end(), allocate_per_region_data(), analyze_arb8(), analyze_arbn(), analyze_ars(), bezier(), bezier_roots(), bezier_subdivide(), bn_2d_chull(), bn_3d_coplanar_chull(), bn_3d_coplanar_obr(), bn_noise_init(), bn_obr_calc(), bn_polyline_2d_chull(), bn_spm_init(), bn_tabdata_malloc_array(), bn_vlblock_init(), bottie_prep_double(), brep_build_bvh(), brep_specific_new(), brep_to_nmg(), bu_argv_from_path(), bu_avs_add(), bu_avs_init(), bu_b64_decode_block(), bu_b64_encode_block(), bu_dir_list(), bu_dup_argv(), bu_dupinsert_argv(), bu_getcwd(), bu_getprogname(), bu_heap_get(), bu_hist_init(), bu_open_mapped_file(), bu_parallel(), bu_ptbl_init(), bu_realpath(), bu_str_escape(), bu_str_unescape(), bu_vlb_init(), bu_vlb_initialize(), build_comb(), buildEdgeTable(), BuildPhotonMap(), BuildTree(), chull3d_data_init(), chull3d_intermediate_set(), db5_attr_create(), db5_attr_dump(), db5_export_attributes(), db5_make_free_object(), db5_make_free_object_hdr(), db_add_node_to_full_path(), db_alloc_directory_block(), db_argv_to_path(), db_search(), db_string_to_path(), db_tree_flatten_describe(), db_walk_tree(), dm_draw_data_axes(), dm_osgInit(), dup_bot(), Eplot(), fbo_cell_tcl(), ged_annotate(), ged_bot_flip(), ged_bot_merge(), ged_bot_split(), ged_bot_sync(), ged_draw_guts(), ged_eac(), ged_edcodes(), ged_erase(), ged_export_polygon(), ged_get_comb(), ged_import_polygon(), ged_killtree(), ged_make(), ged_nirt(), ged_polygons_overlap(), ged_preview(), ged_rrt(), ged_rt(), ged_rtcheck(), ged_rtwizard(), ged_screen_grab(), ged_solids_on_ray(), ged_vnirt(), ged_wcodes(), generate_edge_list(), get_densities_from_database(), get_densities_from_file(), get_tcl_curve(), GetEstimate(), insert_in_bsp(), IrradianceEstimate(), light_obs(), light_pt_allocate(), main(), make_bot_object(), map_to_array(), mk_bot_w_normals(), mk_tree_gift(), nmg_2face_plot(), nmg_assoc_void_shells(), nmg_booltree_evaluate(), nmg_bot(), nmg_brep_face(), nmg_calc_new_v(), nmg_ck_e(), nmg_ck_eu(), nmg_ck_f(), nmg_ck_fg(), nmg_ck_fu(), nmg_ck_l(), nmg_ck_lg(), nmg_ck_lu(), nmg_ck_vs_in_region(), nmg_ck_vu(), nmg_class_pt_s(), nmg_class_ray_vs_shell(), nmg_clone_model(), nmg_close_shell(), nmg_complex_vertex_solve(), nmg_count_shell_kids(), nmg_cut_loop(), nmg_cut_lu_into_coplanar_and_non(), nmg_decompose_shell(), nmg_dup_face(), nmg_dup_shell(), nmg_e_and_v_tabulate(), nmg_edge_fuse(), nmg_edge_g_cnurb(), nmg_edge_g_fuse(), nmg_edge_g_tabulate(), nmg_edge_tabulate(), nmg_edgeuse_on_line_tabulate(), nmg_edgeuse_tabulate(), nmg_enlist_one_vu(), nmg_enlist_vu(), nmg_extrude_face(), nmg_extrude_shell(), nmg_face_g_snurb(), nmg_face_lu_plot(), nmg_face_plot(), nmg_face_tabulate(), nmg_find_e_nearest_pt2(), nmg_find_outer_and_void_shells(), nmg_fix_decomposed_shell_normals(), nmg_has_dangling_faces(), nmg_hollow_shell(), nmg_invert_shell(), nmg_isect_eu_fu(), nmg_loop_split_at_touching_jaunt(), nmg_m_struct_count(), nmg_manifolds(), nmg_mirror_model(), nmg_move_edge_thru_pt(), nmg_pl_2fu(), nmg_pl_comb_fu(), nmg_pl_isect(), nmg_pl_lu_around_eu(), nmg_plot_lu_around_eu(), nmg_plot_lu_ray(), nmg_plot_ray_face(), nmg_polytonmg(), nmg_rebound(), nmg_rt_isect_plfu(), nmg_shell_coplanar_face_merge(), nmg_shell_is_void(), nmg_shell_manifolds(), nmg_show_broken_classifier_stuff(), nmg_snurb_calc_lu_uv_orient(), nmg_split_loops_into_faces(), nmg_to_poly(), nmg_triangulate_rm_degen_loopuse(), nmg_unbreak_region_edges(), nmg_vertex_tabulate(), nmg_vertexuse_normal_tabulate(), nmg_vlblock_s(), order_tbl(), pleu(), print_volume_table(), qray_init(), remove_from_bsp(), rt_arbn_centroid(), rt_arbn_export4(), rt_arbn_surf_area(), rt_arbn_tess(), rt_arbn_volume(), rt_ars_adjust(), rt_ars_export4(), rt_ars_export5(), rt_ars_import5(), rt_ars_mirror(), rt_ars_tess(), rt_bot_adaptive_plot(), rt_bot_adjust(), rt_bot_condense(), rt_bot_create(), rt_bot_export4(), rt_bot_get_edge_list(), rt_bot_import4(), rt_bot_import5(), rt_bot_patches(), rt_bot_smooth(), rt_bot_sort_faces(), rt_bot_split(), rt_bot_split_func(), rt_bot_surf_area(), rt_bot_sync(), rt_bot_sync_func(), rt_bot_tess(), rt_bot_vertex_fuse(), rt_bot_volume(), rt_bot_xform(), rt_cline_export4(), rt_cline_tess(), rt_comb_export4(), rt_comb_export5(), rt_comb_import4(), rt_constraint_export5(), rt_copy_curve(), rt_copy_sketch(), rt_ct_get(), rt_ct_populate_box(), rt_cut_extend(), rt_cut_it(), rt_cut_one_axis(), rt_default_multioverlap(), rt_dsp_export4(), rt_dsp_tess(), rt_ebm_export4(), rt_ebm_export5(), rt_ebm_import4(), rt_ebm_import5(), rt_ebm_tess(), rt_ehy_export4(), rt_ell_export4(), rt_ell_tess(), rt_epa_export4(), rt_epa_tess(), rt_eto_export4(), rt_eto_tess(), rt_extrude_bbox(), rt_extrude_export4(), rt_extrude_export5(), rt_extrude_import4(), rt_extrude_prep(), rt_extrude_shot(), rt_extrude_tess(), rt_generic_make(), rt_grp_export4(), rt_hf_export4(), rt_hlf_export4(), rt_htbl_init(), rt_hyp_export5(), rt_nmg_adjust(), rt_nmg_centroid(), rt_nmg_export4_internal(), rt_nmg_export5(), rt_nmg_import4_internal(), rt_nmg_shot(), rt_nmg_surf_area(), rt_nmg_volume(), rt_nugrid_cut(), rt_nurb_adjust(), rt_nurb_export4(), rt_nurb_import5(), rt_nurb_mirror(), rt_nurb_region_from_srf(), rt_nurb_sinterp(), rt_part_export4(), rt_part_tess(), rt_pg_export4(), rt_pg_to_bot(), rt_pipe_export4(), rt_pipe_tess(), rt_pnts_export5(), rt_poly_mirror(), rt_prep_parallel(), rt_reprep(), rt_res_pieces_init(), rt_revolve_bbox(), rt_revolve_export5(), rt_revolve_plot(), rt_revolve_prep(), rt_rhc_export4(), rt_rhc_tess(), rt_rpc_export4(), rt_rpc_tess(), rt_shader_mat(), rt_sketch_export4(), rt_sketch_import4(), rt_sketch_import5(), rt_submodel_export4(), rt_submodel_export5(), rt_superell_export4(), rt_tgc_export4(), rt_tgc_tess(), rt_tor_export4(), rt_tor_tess(), rt_unprep(), rt_vol_export4(), rt_vol_export5(), rt_vol_import4(), rt_vol_import5(), rt_vshootray(), rt_xxx_export5(), run_client(), run_server(), seg_to_vlist(), set_to_array(), Store(), tables_new(), tcl_obj_to_fastf_array(), tcl_obj_to_int_array(), tesselate_pipe_bend(), tesselate_pipe_end(), tesselate_pipe_linear(), tie_init(), to_data_arrows(), to_data_axes(), to_data_labels(), to_data_lines(), to_dm_func(), to_extract_contours_av(), to_extract_polygons_av(), to_mouse_brep_selection_append(), to_mouse_brep_selection_translate(), to_mouse_joint_select(), to_mouse_joint_selection_translate(), to_mouse_move_botpts(), to_prim_label(), to_view_func_common(), tthrm_setup(), voxelize(), write_comb(), and XGLUE().

Here is the call graph for this function:

void bu_free ( void *  ptr,
const char *  str 
)

Definition at line 328 of file malloc.c.

References bu_debug, BU_DEBUG_MEM_CHECK, BU_DEBUG_MEM_LOG, BU_DEBUG_MEM_QCHECK, BU_LIST_DEQUEUE, BU_LIST_MAGIC_EQUAL, BU_SEM_MALLOC, bu_semaphore_acquire(), bu_semaphore_release(), memdebug::mdb_len, MDB_MAGIC, memdebug_check(), MEMDEBUG_NULL, memqdebug::q, and UNLIKELY.

Referenced by _db_free_full_path_list(), _db_recurse_subtree(), _db_search_full_paths(), _db_walk_subtree(), _ged_build_dpp(), _ged_combadd2(), _ged_drawtrees(), _ged_editit(), _ged_find_matrix(), _ged_free_search_set(), _ged_print_node(), _ged_search_localized_obj_list(), _path_scrub(), _rt_check_overlap(), _rt_getregion(), _rt_gettree_leaf(), add_solid(), analyze_arb8(), analyze_arbn(), analyze_ars(), append_solid_to_display_list(), automatic_test(), bezier(), bezier_roots(), bezier_subdivide(), binterp(), bn_2d_chull(), bn_3d_chull(), bn_3d_coplanar_obr(), bn_gauss_free(), bn_obr_calc(), bn_polyline_2d_chull(), bn_spm_free(), bn_spm_pix_load(), bn_tabdata_binary_read(), bn_tabdata_free(), bn_table_free(), bn_unif_free(), bn_vlist_cleanup(), bot2vrml(), bot_ifree2(), bottie_prep_double(), brep_build_bvh(), brep_conversion_comb(), brep_conversion_tree(), brep_specific_delete(), bu_argv_from_path(), bu_avs_add(), bu_avs_free(), bu_avs_remove(), bu_backtrace(), bu_bitv_free(), bu_brlcad_root(), bu_cv_w_cookie(), bu_dirname(), bu_free_argv(), bu_free_array(), bu_free_external(), bu_free_mapped_files(), bu_getprogname(), bu_heap_put(), bu_hist_free(), bu_lex(), bu_list_free(), bu_open_mapped_file(), bu_parallel(), bu_ptbl_free(), bu_rb_delete(), bu_rb_free(), bu_realloc(), bu_scan_fastf_t(), bu_shader_to_key_eq(), bu_shader_to_list(), bu_str_escape(), bu_str_unescape(), bu_struct_export(), bu_struct_get(), bu_vlb_free(), bu_vls_free(), bu_vls_vlsfree(), build_comb(), build_vertex_tree(), BuildPhotonMap(), BuildTree(), bw_read(), bw_write(), check_hitstate(), cho_deleteProc(), chull3d_data_free(), comb_flatten(), comb_lift_region(), combmem_get(), compare_bu_to_system_basename(), control_polygon_flat_enough(), db5_attr_ctype_free(), db5_scan(), db5_update_ident(), db_apply_anims(), db_apply_state_from_comb(), db_apply_state_from_memb(), db_close(), db_comb_mvall(), db_delete(), db_dirdelete(), db_do_anim(), db_follow_path(), db_free_1anim(), db_free_combined_tree_state(), db_free_db_tree_state(), db_free_full_path(), db_free_tree(), db_fullpath_list_subtree(), db_functree(), db_get_external(), db_getmrec(), db_inmem(), db_open(), db_pr_combined_tree_state(), db_pr_full_path(), db_preorder_traverse(), db_recurse(), db_search(), db_search_free(), db_string_to_path(), db_tree_flatten_describe(), db_tree_parse(), db_update_ident(), db_walk_tree(), db_write_anim(), db_zapper(), decimate_edge(), delete_edge(), diff_free_avp(), diff_free_result(), dm_draw_data_axes(), dmo_deleteProc(), dmo_open_tcl(), do_inter(), do_paren(), do_region_end(), do_region_end1(), do_region_end2(), do_union_subtr(), edit_arg_free(), edit_arg_free_inner(), edit_arg_to_coord(), edit_str_to_arg(), Eplot(), eval_bool(), eval_op(), fb_write_fp(), fbo_cell_tcl(), fbo_deleteProc(), find_cmd_line_obj(), findjoint(), FindLoops(), fix_halfs(), free_etree(), free_soup(), free_vert_tree(), gauss_free(), gcv_bot_is_closed_fan(), gcv_bot_is_orientable(), gcv_bot_is_solid(), gcv_fastgen4_read(), gcv_region_end(), gcv_region_end_mc(), ged_3ptarb(), ged_annotate(), ged_arced(), ged_bot_flip(), ged_bot_merge(), ged_bot_split(), ged_bot_sync(), ged_concat(), ged_copymat(), ged_decompose(), ged_draw_guts(), ged_dup(), ged_E(), ged_eac(), ged_edcodes(), ged_editit(), ged_edmater(), ged_erase(), ged_get_bot_edges(), ged_gqa(), ged_how(), ged_import_polygon(), ged_killtree(), ged_lc(), ged_loadframe(), ged_loadview(), ged_ls(), ged_nirt(), ged_polygons_overlap(), ged_push(), ged_results_clear(), ged_results_free(), ged_rrt(), ged_rt(), ged_rtcheck(), ged_rtwizard(), ged_screen_grab(), ged_search(), ged_set_output_script(), ged_set_transparency(), ged_shells(), ged_solids_on_ray(), ged_tops(), ged_track2(), ged_tree(), ged_units(), ged_vnirt(), ged_wcodes(), generate_edge_list(), get_densities_from_database(), get_densities_from_file(), get_kernel(), get_kernel3(), GetEstimate(), headsolid_split(), icv_crop(), icv_destroy(), icv_filter(), icv_gray2rgb(), icv_median(), icv_rect(), icv_rgb2gray(), icv_rot(), image_flip(), img_load_datasource(), insert_in_bsp(), Irradiance(), IrradianceEstimate(), isect_ray_snurb_face(), killtree_callback(), light_free(), light_obs(), light_pt_allocate(), main(), make_bot_object(), make_ellipse(), make_model_from_face(), make_near_list(), maxEdge(), minEdge(), mk_freemembers(), mk_pipe_free(), mk_tree_gift(), move_all_func(), ninterp(), nmg_2face_plot(), nmg_assoc_void_shells(), nmg_bot(), nmg_brep_face(), nmg_calc_new_v(), nmg_ck_e(), nmg_ck_eu(), nmg_ck_f(), nmg_ck_fg(), nmg_ck_fu(), nmg_ck_l(), nmg_ck_lg(), nmg_ck_lu(), nmg_ck_vs_in_region(), nmg_ck_vu(), nmg_class_pt_fu_except(), nmg_class_pt_lu_except(), nmg_class_pt_s(), nmg_class_ray_vs_shell(), nmg_clone_model(), nmg_close_shell(), nmg_cnurb_to_vlist(), nmg_complex_vertex_solve(), nmg_count_shell_kids(), nmg_cut_loop(), nmg_cut_lu_into_coplanar_and_non(), nmg_decompose_shell(), nmg_dup_face(), nmg_e_and_v_tabulate(), nmg_edge_fuse(), nmg_edge_g_fuse(), nmg_edge_g_tabulate(), nmg_edge_tabulate(), nmg_edgeuse_on_line_tabulate(), nmg_edgeuse_tabulate(), nmg_extrude_face(), nmg_extrude_shell(), nmg_face_coincident_vu_sort(), nmg_face_lu_plot(), nmg_face_plot(), nmg_face_tabulate(), nmg_fcut_face(), nmg_find_e_nearest_pt2(), nmg_find_outer_and_void_shells(), nmg_fix_decomposed_shell_normals(), nmg_fix_normals(), nmg_fix_overlapping_loops(), nmg_fuse_inters(), nmg_get_edge_lines(), nmg_has_dangling_faces(), nmg_hollow_shell(), nmg_invert_shell(), nmg_isect2d_cleanup(), nmg_isect_eu_fu(), nmg_keg(), nmg_km(), nmg_loop_split_at_touching_jaunt(), nmg_merge_models(), nmg_mirror_model(), nmg_move_edge_thru_pt(), nmg_open_shells_connect(), nmg_pl_2fu(), nmg_pl_comb_fu(), nmg_pl_isect(), nmg_pl_lu_around_eu(), nmg_plot_lu_around_eu(), nmg_plot_lu_ray(), nmg_plot_ray_face(), nmg_polytonmg(), nmg_pr_m_struct_counts(), nmg_rebound(), nmg_region_end(), nmg_rt_isect_plfu(), nmg_shell_coplanar_face_merge(), nmg_shell_is_void(), nmg_shell_manifolds(), nmg_show_broken_classifier_stuff(), nmg_snurb_calc_lu_uv_orient(), nmg_snurb_to_vlist(), nmg_split_loops_into_faces(), nmg_translate_face(), nmg_triangulate_fu(), nmg_triangulate_rm_degen_loopuse(), nmg_unbreak_region_edges(), nmg_vertex_tabulate(), nmg_vertexuse_normal_tabulate(), nmg_vlblock_s(), ON_Intersect(), parse_key_val_to_vls(), pix_read(), pleu(), plot_close(), ppm_read(), Print_tree(), print_volume_table(), ps_close(), qray_free(), rb_free_node(), rb_free_package(), remove_from_bsp(), rr_hit(), rr_render(), rt_advance_to_next_cell(), rt_arb_brep(), rt_arb_free(), rt_arb_ifree(), rt_arbn_adjust(), rt_arbn_brep(), rt_arbn_centroid(), rt_arbn_export4(), rt_arbn_export5(), rt_arbn_free(), rt_arbn_ifree(), rt_arbn_import4(), rt_arbn_import5(), rt_arbn_prep(), rt_arbn_surf_area(), rt_arbn_tess(), rt_arbn_volume(), rt_ars_adjust(), rt_ars_brep(), rt_ars_ifree(), rt_ars_mirror(), rt_ars_tess(), rt_binunif_adjust(), rt_binunif_free(), rt_binunif_ifree(), rt_bot_adaptive_plot(), rt_bot_adjust(), rt_bot_brep(), rt_bot_condense(), rt_bot_create(), rt_bot_decimate(), rt_bot_export5(), rt_bot_face_fuse(), rt_bot_find_e_nearest_pt2(), rt_bot_list_free(), rt_bot_patches(), rt_bot_smooth(), rt_bot_sort_faces(), rt_bot_split(), rt_bot_split_func(), rt_bot_surf_area(), rt_bot_sync(), rt_bot_sync_func(), rt_bot_tess(), rt_bot_vertex_fuse(), rt_bot_volume(), rt_brep_get(), rt_brep_ifree(), rt_clean(), rt_clean_resource_basic(), rt_clean_resource_complete(), rt_cline_brep(), rt_cline_ifree(), rt_cline_tess(), rt_color_free(), rt_comb_export4(), rt_comb_ifree(), rt_comb_import4(), rt_comb_import5(), rt_constraint_ifree(), rt_ct_populate_box(), rt_ct_release_storage(), rt_curve_free(), rt_cut_clean(), rt_cut_it(), rt_del_regtree(), rt_do_cmd(), rt_dsp_bbox(), rt_dsp_free(), rt_dsp_ifree(), rt_dsp_tess(), rt_ebm_brep(), rt_ebm_ifree(), rt_ebm_import4(), rt_ebm_import5(), rt_ebm_tess(), rt_ehy_adaptive_plot(), rt_ehy_ifree(), rt_ehy_import4(), rt_ehy_import5(), rt_ehy_plot(), rt_ehy_tess(), rt_ell_ifree(), rt_ell_tess(), rt_epa_adaptive_plot(), rt_epa_ifree(), rt_epa_import4(), rt_epa_import5(), rt_epa_plot(), rt_epa_tess(), rt_eto_ifree(), rt_eto_plot(), rt_eto_tess(), rt_extrude_adjust(), rt_extrude_bbox(), rt_extrude_brep(), rt_extrude_free(), rt_extrude_ifree(), rt_extrude_import4(), rt_extrude_import5(), rt_extrude_shot(), rt_extrude_tess(), rt_find_paths(), rt_free_rti(), rt_free_soltab(), rt_grp_ifree(), rt_hf_ifree(), rt_hf_import4(), rt_hlf_ifree(), rt_hrt_ifree(), rt_hrt_plot(), rt_hrt_vshot(), rt_htbl_free(), rt_hyp_ifree(), rt_hyp_tess(), rt_hyp_volume(), rt_insert_color(), rt_joint_ifree(), rt_linear_pipe_prep(), rt_memclose(), rt_metaball_export5(), rt_metaball_free(), rt_metaball_ifree(), rt_metaball_import5(), rt_nmg_adjust(), rt_nmg_centroid(), rt_nmg_export4_fastf(), rt_nmg_export4_internal(), rt_nmg_export5(), rt_nmg_import4_fastf(), rt_nmg_import4_internal(), rt_nmg_shot(), rt_nmg_surf_area(), rt_nmg_volume(), rt_nugrid_cut(), rt_nurb_adjust(), rt_nurb_c_eval(), rt_nurb_c_split(), rt_nurb_c_xsplit(), rt_nurb_cinterp(), rt_nurb_clean_cnurb(), rt_nurb_clean_snurb(), rt_nurb_doolittle(), rt_nurb_export5(), rt_nurb_free_cnurb(), rt_nurb_free_oslo(), rt_nurb_free_snurb(), rt_nurb_ifree(), rt_nurb_import5(), rt_nurb_kvmult(), rt_nurb_mirror(), rt_nurb_plot(), rt_nurb_region_from_srf(), rt_nurb_reverse_srf(), rt_nurb_s_eval(), rt_nurb_s_flat(), rt_nurb_s_split(), rt_nurb_s_xsplit(), rt_nurb_shot(), rt_nurb_sinterp(), rt_nurb_solve(), rt_part_ifree(), rt_part_import4(), rt_part_import5(), rt_part_tess(), rt_pg_brep(), rt_pg_ifree(), rt_pg_tess(), rt_pipe_export5(), rt_pipe_ifree(), rt_pipe_import5(), rt_pipe_tess(), rt_pnts_ifree(), rt_poly_mirror(), rt_pr_tree_str(), rt_pr_tree_vls(), rt_prep_parallel(), rt_read_cmd(), rt_rebuild_overlaps(), rt_regionfix(), rt_reprep(), rt_res_pieces_clean(), rt_revolve_bbox(), rt_revolve_brep(), rt_revolve_free(), rt_revolve_ifree(), rt_revolve_import5(), rt_revolve_plot(), rt_rhc_adaptive_plot(), rt_rhc_ifree(), rt_rhc_import4(), rt_rhc_import5(), rt_rhc_plot(), rt_rhc_tess(), rt_rpc_adaptive_plot(), rt_rpc_ifree(), rt_rpc_import4(), rt_rpc_import5(), rt_rpc_plot(), rt_rpc_tess(), rt_shader_mat(), rt_shootrays(), rt_sketch_adjust(), rt_sketch_export4(), rt_sketch_export5(), rt_sketch_ifree(), rt_sketch_import4(), rt_sketch_import5(), rt_submodel_free(), rt_submodel_ifree(), rt_submodel_import4(), rt_submodel_import5(), rt_submodel_wireframe_leaf(), rt_superell_ifree(), rt_tcl_pr_hit(), rt_tgc_adaptive_plot(), rt_tgc_ifree(), rt_tgc_tess(), rt_tgc_vshot(), rt_tor_ifree(), rt_tor_plot(), rt_tor_tess(), rt_tor_vshot(), rt_unprep(), rt_vlblock_free(), rt_vol_brep(), rt_vol_free(), rt_vol_ifree(), rt_vshootray(), rt_xxx_free(), rt_xxx_ifree(), run_client(), run_server(), seg_to_vlist(), shoot_and_plot(), Store(), stxt_free(), stxt_read(), subbrep_object_free(), tables_new(), tesselate_pipe_bend(), tesselate_pipe_end(), tesselate_pipe_linear(), tie_free(), tie_kdtree_free(), tie_kdtree_prep(), to_data_arrows(), to_data_axes(), to_data_labels(), to_data_lines(), to_data_polygons(), to_deleteProc(), to_deleteProc_rt(), to_deleteViewProc(), to_dm_func(), to_edit_redraw(), to_more_args_func(), to_mouse_brep_selection_append(), to_mouse_brep_selection_translate(), to_mouse_joint_select(), to_mouse_joint_selection_translate(), to_mouse_move_botpts(), to_new_view(), to_polygon_free(), to_polygons_free(), to_prim_label(), to_view_func_common(), tthrm_free(), txt_load_datasource(), vfont_free(), vfont_get(), voxelize(), wdb_close(), wdb_importFg4Section_cmd(), and XGLUE().

Here is the call graph for this function:

void* bu_realloc ( void *  ptr,
size_t  siz,
const char *  str 
)

bu_malloc()/bu_free() compatible wrapper for realloc().

this routine mimics the C99 standard behavior of realloc() except that NULL will never be returned. it will bomb if siz is zero and ptr is NULL. it will return a minimum allocation suitable for bu_free() if siz is zero and ptr is non-NULL.

While the string 'str' is provided for the log messages, don't disturb the str value, so that this storage allocation can be tracked back to its original creator.

Referenced by Add_bot_face(), Add_face(), Add_vert(), Add_vert_and_norm(), bn_multipoly_grow(), bu_avs_add(), bu_avs_add_nonunique(), bu_heap_get(), bu_ptbl_cat(), bu_ptbl_cat_uniq(), bu_ptbl_ins(), bu_struct_get(), bu_vlb_write(), bu_vls_extend(), bw_read(), db5_realloc(), db_add_node_to_full_path(), db_alloc(), db_extend_full_path(), do_grid(), Eplot(), ged_bot_edge_split(), ged_bot_face_split(), insert_in_bsp(), IrradianceEstimate(), killtree_callback(), leaf_tess1(), leaf_tess2(), light_pt_allocate(), make_hole_in_prepped_regions(), nmg_enlist_one_vu(), nmg_enlist_vu(), nmg_polytonmg(), nmg_show_broken_classifier_stuff(), nmg_triangulate_rm_degen_loopuse(), parse_densities_buffer(), pix_read(), rt_arbn_adjust(), rt_ars_adjust(), rt_binunif_adjust(), rt_bot_adjust(), rt_bot_condense(), rt_bot_decimate(), rt_bot_face_fuse(), rt_bot_vertex_fuse(), rt_ct_populate_box(), rt_cut_extend(), rt_grow_boolstack(), rt_htbl_get(), rt_pnts_export5(), rt_read_cmd(), rt_reprep(), rt_tgc_tess(), rt_vlblock_find(), shrink_image(), soup_add_face_precomputed(), tie_kdtree_prep(), tie_push(), to_data_polygons(), under_sample(), and wcodes_printcodes().

void bu_prmem ( const char *  str)

Print map of memory currently in use.

Definition at line 516 of file malloc.c.

References bu_bomb(), bu_debug, BU_DEBUG_MEM_CHECK, BU_DEBUG_MEM_QCHECK, BU_LIST_EACH, BU_LIST_MAGIC_EQUAL, BU_LIST_NULL, bu_strdup_message, bu_vls_message, memqdebug::m, memdebug::magic, memdebug::mdb_addr, memdebug::mdb_len, MDB_MAGIC, memdebug::mdb_str, memqdebug::q, and UNLIKELY.

Referenced by ged_debugmem(), and tcl_bu_prmem().

Here is the call graph for this function:

int bu_malloc_len_roundup ( int  nbytes)

On systems with the CalTech malloc(), the amount of storage ACTUALLY ALLOCATED is the amount requested rounded UP to the nearest power of two. For structures which are acquired and released often, this works well, but for structures which will remain unchanged for the duration of the program, this wastes as much as 50% of the address space (and usually memory as well). Here, we round up a byte size to the nearest power of two, leaving off the malloc header, so as to ask for storage without wasting any.

On systems with the traditional malloc(), this strategy will just consume the memory in somewhat larger chunks, but overall little unused memory will be consumed.

Referenced by db_alloc_directory_block(), rt_alloc_seg_block(), and rt_ct_get().

void bu_ck_malloc_ptr ( void *  ptr,
const char *  str 
)

For a given pointer allocated by bu_malloc(), bu_calloc(), or BU_ALLOC() check the magic number stored after the allocation area when BU_DEBUG_MEM_CHECK is set.

This is the individual version of bu_mem_barriercheck().

returns if pointer good or BU_DEBUG_MEM_CHECK not set, bombs if memory is corrupted.

Definition at line 614 of file malloc.c.

References bu_bomb(), bu_debug, BU_DEBUG_MEM_CHECK, BU_DEBUG_MEM_QCHECK, BU_LIST_MAGIC_EQUAL, memqdebug::m, memdebug::magic, memdebug::mdb_addr, memdebug::mdb_len, MDB_MAGIC, memqdebug::q, and UNLIKELY.

Here is the call graph for this function:

int bu_mem_barriercheck ( void  )

Check all entries in the memory debug table for barrier word corruption. Intended to be called periodically through an application during debugging. Has to run single-threaded, to prevent table mutation.

This is the bulk version of bu_ck_malloc_ptr()

Returns - -1 something is wrong 0 all is OK;

Definition at line 660 of file malloc.c.

References bu_bomb(), BU_SEM_MALLOC, bu_semaphore_acquire(), bu_semaphore_release(), memdebug::magic, memdebug::mdb_addr, memdebug::mdb_len, MDB_MAGIC, memdebug::mdb_str, and UNLIKELY.

Referenced by Add_bot_face(), curve_to_vlist(), do_grid(), do_tri(), ged_E(), main(), rt_copy_sketch(), rt_extrude_xform(), rt_revolve_xform(), rt_sketch_export4(), rt_sketch_export5(), rt_sketch_ifree(), rt_sketch_import4(), rt_sketch_import5(), shoot_and_plot(), and tcl_bu_mem_barriercheck().

Here is the call graph for this function:

void* bu_heap_get ( size_t  sz)

really fast heap-based memory allocation intended for "small" allocation sizes (e.g., single structs).

the implementation allocates chunks of memory ('pages') in order to substantially reduce calls to system malloc. it has a nice property of having O(1) constant time complexity and profiles significantly faster than system malloc().

release memory with bu_heap_put() only.

Definition at line 171 of file heap.c.

References bu_bomb(), bu_calloc(), bu_debug, BU_DEBUG_COREDUMP, BU_DEBUG_MEM_CHECK, bu_log(), bu_malloc(), bu_parallel_id(), bu_realloc(), heap::count, heap::given, cpus::heap, cpus::misses, and heap::pages.

Referenced by main().

Here is the call graph for this function:

void bu_heap_put ( void *  ptr,
size_t  sz 
)

counterpart to bu_heap_get() for releasing fast heap-based memory allocations.

the implementation may do nothing, relying on free-on-exit, or may mark deallocations for reuse. pass a NULL pointer and zero size to force compaction of any unused memory.

Definition at line 232 of file heap.c.

References bu_free().

Referenced by main().

Here is the call graph for this function:

bu_heap_func_t bu_heap_log ( bu_heap_func_t  log)

This function registers and returns the current printing function that will be used during application exit (via an atexit() handler) if the BU_HEAP_PRINT environment variable is set. Statistics on calls to bu_heap_get() and bu_heap_put() will be logged. If log is NULL, the currently set function will remain unchanged and will be returned.

Definition at line 97 of file heap.c.

References bu_log().

Here is the call graph for this function:

int bu_shmget ( int *  shmid,
char **  shared_memory,
int  key,
size_t  size 
)

Attempt to get shared memory - returns -1 if new memory was created, 0 if successfully returning existing memory, and 1 if the attempt failed.

Definition at line 692 of file malloc.c.

Variable Documentation

long bu_n_malloc

number of calls to bu_malloc()/bu_calloc()/bu_alloc().

used by rt. not semaphore-protected and is thus only an estimate.

Definition at line 42 of file globals.c.

Referenced by alloc().

long bu_n_realloc

number of calls to bu_realloc().

used by rt. not semaphore-protected and is thus only an estimate.

Definition at line 50 of file globals.c.

Referenced by bu_realloc().