|
GRASS 8 Programmer's Manual 8.6.0dev(2026)-ddeab64dbf
|
GIS Library - Memory allocation routines. More...

Go to the source code of this file.
Functions | |
| void * | G__malloc (const char *file, int line, size_t n) |
| Memory allocation. | |
| void * | G__calloc (const char *file, int line, size_t m, size_t n) |
| Memory allocation. | |
| void * | G__realloc (const char *file, int line, void *buf, size_t n) |
| Memory reallocation. | |
| void | G_free (void *buf) |
| Free allocated memory. | |
GIS Library - Memory allocation routines.
(C) 1999-2009 by the GRASS Development Team
This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.
Definition in file gis/alloc.c.
Memory allocation.
Allocates a properly aligned block of memory n*m bytes in length, initializes the allocated memory to zero, and returns a pointer to the allocated block of memory.
Dies with error message on memory allocation fail.
Note: Allocating memory for reading and writing raster maps is discussed in Allocating Raster I/O Buffers.
| file | fine name |
| line | line number |
| m | element size |
| n | number of elements |
Definition at line 71 of file gis/alloc.c.
References _, Cell_head::cols, file, G_fatal_error(), G_get_window(), G_important_message(), and Cell_head::rows.
Memory allocation.
Allocates a block of memory at least n bytes which is aligned properly for all data types. A pointer to the aligned block is returned.
Dies with error message on memory allocation fail.
| file | file name |
| line | line number |
| n | number of elements |
Definition at line 31 of file gis/alloc.c.
References _, Cell_head::cols, file, G_fatal_error(), G_get_window(), G_important_message(), malloc(), and Cell_head::rows.
Memory reallocation.
Changes the size of a previously allocated block of memory at ptr and returns a pointer to the new block of memory. The size may be larger or smaller than the original size. If the original block cannot be extended "in place", then a new block is allocated and the original block copied to the new block.
Note: If buf is NULL, then this routine simply allocates a block of n bytes else buf must point to memory that has been dynamically allocated by G_malloc(), G_calloc(), G_realloc(), malloc(3), alloc(3), or realloc(3).. This routine works around broken realloc() routines, which do not handle a NULL buf.
| file | file name | |
| line | line number | |
| [in,out] | buf | buffer holding original data |
| [in] | n | array size |
Definition at line 117 of file gis/alloc.c.
References _, Cell_head::cols, file, G_fatal_error(), G_get_window(), G_important_message(), malloc(), and Cell_head::rows.
Free allocated memory.
| [in,out] | buf | buffer holding original data |
Definition at line 147 of file gis/alloc.c.
References free().
Referenced by AS_class_discont(), AS_class_equiprob(), Cairo_end_raster(), cairo_read_ppm(), Cairo_Text(), Cairo_text_box(), cairo_write_ppm(), check_create_export_opts(), check_create_import_opts(), close_band_files(), COM_Set_encoding(), D_open_driver(), db_CatValArray_free(), db_d_append_error(), db_read_dbmscap(), db_select_CatValArray(), db_select_int(), db_select_value(), destroy_si_struct(), dig__frealloc(), dig_cidx_free(), dig_file_free(), dig_file_load(), dig_free_area(), dig_free_isle(), dig_free_line(), dig_free_node(), dig_free_plus_areas(), dig_free_plus_isles(), dig_free_plus_lines(), dig_free_plus_nodes(), dig_spidx_free_areas(), dig_spidx_free_isles(), dig_spidx_free_lines(), dig_spidx_free_nodes(), dig_spidx_init(), err(), f_median(), f_mode(), f_nmedian(), f_nmode(), fft(), find_all_intersections(), font_init_freetype(), free_datum_list(), free_ellps_list(), free_fontcap(), free_perimeters(), free_slice_buff(), free_vol_buff(), free_volfile_buffs(), G__json(), G__md_print_python_short_version(), G__read_Cell_head(), G__usage_xml(), G__wps_print_process_description(), G_bz2_compress(), G_free_fmatrix(), G_free_fvector(), G_free_ilist(), G_free_imatrix(), G_free_ivector(), G_free_key_value(), G_free_list(), G_free_matrix(), G_free_tokens(), G_free_vector(), G_get_available_mapsets(), G_get_projsrid(), G_get_projwkt(), G_init_ilist(), G_list(), G_ls(), G_ls_regex_filter(), G_lz4_compress(), G_math_egvorder(), G_math_free_spmatrix(), G_math_free_spvector(), G_math_solver_gs(), G_math_solver_jacobi(), G_math_solver_lu(), G_math_solver_sparse_gs(), G_math_solver_sparse_jacobi(), G_matrix_eigen_sort(), G_matrix_free(), G_matrix_LU_solve(), G_plot_area(), G_putenv(), G_rc_path(), G_read_compressed(), G_set_key_value(), G_set_program_name(), G_str_concat(), G_vector_free(), G_write_compressed(), G_zlib_compress(), G_zstd_compress(), get_pj_area(), gk_free_key(), gk_make_framesfromkeys(), gk_make_linear_framesfromkeys(), gp_free_site(), gp_free_sitemem(), Gp_load_sites(), Gp_load_sites_thematic(), GPJ__get_ellipsoid_params(), GPJ_free_datum(), GPJ_free_datum_transform(), GPJ_free_ellps(), GPJ_grass_to_osr(), GPJ_init_transform(), GPJ_osr_to_grass(), GPJ_set_csv_loc(), GPJ_transform_array(), GS_coordpair_repeats(), gs_free_surf(), Gs_get_cat_label(), gs_init_normbuff(), GS_load_att_map(), Gs_loadmap_as_bitmap(), Gs_loadmap_as_char(), Gs_loadmap_as_float(), Gs_loadmap_as_int(), Gs_loadmap_as_short(), gs_malloc_lookup(), Gs_pack_colors(), Gs_pack_colors_float(), gs_set_att_src(), GS_write_ppm(), GS_write_tif(), gsd_put_legend(), gsd_wall(), gsds_free_datah(), gv_free_vect(), gv_free_vectmem(), Gv_load_vect(), gvd_vect(), gvl_align_data(), gvl_file_free_datah(), gvl_file_set_mode(), gvl_free_vol(), gvl_isosurf_calc(), GVL_isosurf_del(), gvl_isosurf_freemem(), Gvl_load_colors_data(), GVL_slice_del(), gvl_slice_freemem(), Gvl_unload_colors_data(), gvld_isosurf(), html_polygon(), HTML_Text(), I_alloc_double3(), I_create_cat_rast(), I_free(), I_free_double2(), I_free_double3(), I_free_int2(), I_free_signatures_list(), I_iclass_free_statistics(), I_insert_patch_to_cat_rast(), I_rasterize(), I_sc_free_cats(), I_signatures_copy(), I_sort_signatures_by_semantic_label(), I_SortSigSetBySemanticLabel(), IL_interp_segments_2d(), IL_interp_segments_2d_parallel(), IL_resample_interp_segments_2d(), kdtree_destroy(), line_check_intersection2(), M_do_copy(), make_perimeter(), N_assemble_les_2d_param(), N_assemble_les_3d_param(), N_free_array_2d(), N_free_array_3d(), N_free_geom_data(), N_free_gradient_2d(), N_free_gradient_3d(), N_free_gradient_field_2d(), N_free_gradient_field_3d(), N_free_gradient_neighbours_2d(), N_free_gradient_neighbours_3d(), N_free_gradient_neighbours_x(), N_free_gradient_neighbours_y(), N_free_gradient_neighbours_z(), N_free_gwflow_data2d(), N_free_gwflow_data3d(), N_free_les(), N_free_solute_transport_data2d(), N_free_solute_transport_data3d(), N_gwflow_2d_calc_water_budget(), N_gwflow_3d_calc_water_budget(), N_init_geom_data_2d(), N_les_integrate_dirichlet_2d(), N_les_integrate_dirichlet_3d(), N_read_rast_to_array_2d(), N_write_array_2d_to_rast(), NetA_articulation_points(), NetA_betweenness_closeness(), NetA_compute_bridges(), NetA_eigenvector_centrality(), NetA_find_path(), NetA_flow(), NetA_min_cut(), NetA_spanning_tree(), NetA_strongly_connected_components(), NetA_timetable_result_release(), NetA_weakly_connected_components(), Nviz_delete_scalebar(), Nviz_destroy_data(), Nviz_destroy_render_window(), Nviz_draw_all_site(), Nviz_draw_all_surf(), Nviz_draw_all_vol(), Nviz_get_exag(), Nviz_get_exag_height(), Nviz_new_fringe(), Nviz_new_map_obj(), Nviz_set_arrow(), Nviz_set_focus_map(), Nviz_set_fringe(), Nviz_set_scalebar(), path_free(), pg_destroy_struct(), pj_do_transform(), pj_get_kv(), pj_get_string(), PNG_Graph_close(), Rast__check_for_auto_masking(), Rast__close_null(), Rast__color_free_fp_lookup(), Rast__color_free_lookup(), Rast__color_free_rules(), Rast__create_window_mapping(), Rast__open_null_write(), Rast__open_old(), Rast__quant_import(), Rast_clear_history(), Rast_close_gdal_link(), Rast_close_gdal_write_link(), Rast_close_vrt(), Rast_command_history(), Rast_format_history(), Rast_fpreclass_reset(), Rast_free_cats(), Rast_free_cell_stats(), Rast_free_histogram(), Rast_free_history(), Rast_free_reclass(), Rast_get_null_value_row(), Rast_get_reclass(), Rast_get_row_colors(), Rast_get_sample_bilinear(), Rast_get_sample_cubic(), Rast_get_sample_nearest(), Rast_get_vrt_row(), Rast_map_to_img_str(), Rast_put_cell_title(), Rast_put_reclass(), Rast_quant_add_rule(), Rast_quant_free(), Rast_read_color_rules(), Rast_read_fp_range(), Rast_read_range(), Rast_read_rstats(), Rast_set_d_cat(), Rast_set_history(), Rast_sort_cats(), read_pgm(), read_png(), Segment_close(), Segment_release(), set_proj_share(), tgis_free_map_list(), tgis_init_map_list(), tgis_set_default_connection(), V1_close_nat(), V1_close_ogr(), V1_close_pg(), V1_open_old_nat(), V2__update_area_pg(), V2_open_old_ogr(), V2_rewrite_line_pg(), Vect__close_cursor_pg(), Vect__copy_areas(), Vect__free_cache(), Vect__free_offset(), Vect__insert_face_pg(), Vect__read_head(), Vect__write_head(), Vect_add_dblink(), Vect_break_polygons_file(), Vect_build_ogr(), Vect_build_partial(), Vect_build_pg(), Vect_build_sidx_from_topo(), Vect_cat_list_to_array(), Vect_cats_set_constraint(), Vect_cidx_open(), Vect_close(), Vect_copy_map_lines_field(), Vect_copy_table_by_cat_list(), Vect_copy_tables(), Vect_default_field_info(), Vect_destroy_boxlist(), Vect_destroy_cat_list(), Vect_destroy_cats_struct(), Vect_destroy_field_info(), Vect_destroy_line_struct(), Vect_destroy_list(), Vect_destroy_map_struct(), Vect_get_column_names(), Vect_get_column_names_types(), Vect_get_column_types(), Vect_get_finfo_dsn_name(), Vect_get_finfo_geometry_type(), Vect_get_finfo_layer_name(), Vect_get_map_box1(), Vect_line_intersection2(), Vect_new_varray(), Vect_open_fidx(), Vect_read_area_geos(), Vect_read_ascii(), Vect_read_line(), Vect_read_next_line(), Vect_rename(), Vect_set_comment(), Vect_set_date(), Vect_set_map_date(), Vect_set_map_name(), Vect_set_organization(), Vect_set_person(), Vect_set_varray_from_db(), Vect_sfa_get_num_features(), Vect_snap_line(), Vect_subst_var(), Vect_topo_dump(), Vect_write_ascii(), Vedit_move_vertex(), write_pgm(), and write_png().