diff options
author | Christian C <cc@localhost> | 2025-04-01 20:46:17 -0700 |
---|---|---|
committer | Christian C <cc@localhost> | 2025-04-01 20:46:17 -0700 |
commit | ec7436a01deb8e28743de47ad98950c914d6da2a (patch) | |
tree | 765212b89d5c9740408d3d8bda8e1daacf55890e /src | |
parent | a18cea2fef7aa1545c9a984b60919541b26a6f84 (diff) |
Global Allocator Checking
Diffstat (limited to 'src')
-rw-r--r-- | src/prog.c | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -9,6 +9,7 @@ #include <lib/dir.h> #include <lib/file.h> #include <lib/lib.h> +#include <lib/mem/galloc.h> #include <lib/monad.h> #include <lib/png.h> #include <lib/seg/mask_data.h> @@ -96,7 +97,7 @@ int main(int arg_count, char **arg_value) { for (size_t index = 0; file_list[index] != NULL; index++) { char *fname = file_list[index]; if (is_tif_ext(fname) == FALSE) { - free(file_list[index]); + g_free(file_list[index]); continue; } // If we have a tiff file @@ -106,7 +107,7 @@ int main(int arg_count, char **arg_value) { // 4. Free up allocations made in this process char *fpath = full_path(process_directory, fname); if (fpath == NULL) { - free(file_list[index]); + g_free(file_list[index]); continue; } if (!suppress_outputs_b) { @@ -117,8 +118,8 @@ int main(int arg_count, char **arg_value) { //----------------------------------------------- Mask *file_im = tif_to_labels(fpath, &starting_label); if (file_im == NULL) { - free(fpath); - free(file_list[index]); + g_free(fpath); + g_free(file_list[index]); continue; } //----------------------------------------------- @@ -126,10 +127,10 @@ int main(int arg_count, char **arg_value) { //----------------------------------------------- masks_im = combine_masks(masks_im, file_im); free_image_mask(file_im); - free(fpath); - free(file_list[index]); + g_free(fpath); + g_free(file_list[index]); } - free(file_list); + g_free(file_list); } } } @@ -205,7 +206,7 @@ int main(int arg_count, char **arg_value) { Bitmap *bitmap = image_mask_data_to_bitmap(masks_im); if (bitmap != NULL) { save_png(bitmap, png_output_file_fullpath); - free(bitmap); + g_free(bitmap); } write_array(bin_output_file_fullpath, masks_im->image[0], width * height * sizeof(MaskData_t)); @@ -215,5 +216,6 @@ int main(int arg_count, char **arg_value) { if (!suppress_outputs_b) { printf("Finished in %f ms\n", 1000 * diff_time(&ts_g_end, &ts_g_start)); } + printf("Outstanding allocations: %zu\n", g_outstanding_allocations()); return 0; } |