barbagroup/PetIBM

Memory leaks

jedbrown opened this issue · 1 comments

Running debug PETSc with -malloc_test or -malloc_dump reveals memory leaks due to unfreed objects. These can also be tracked down with Valgrind. I couldn't tell how serious they were from a quick assessment, but they should definitely be fixed.

Thank you @jedbrown !

We have fixed this issue in the branch joss-review. Now with the PETSc flag -malloc_test, there is no memory leak anymore.

With Valgrind, however, it can be seen there are still some memory issues regarding HDF5 in PETSc library itself, as explained in #131. Here is a quick view into one of the Valgrind messages:

==15479== 2,240 bytes in 5 blocks are definitely lost in loss record 54 of 54
==15479==    at 0x73C9EDF: malloc (vg_replace_malloc.c:299)
==15479==    by 0x1FE37BE9: ???
==15479==    by 0x1EDC5CB0: ???
==15479==    by 0x1EBBC4B2: ???
==15479==    by 0x147441AE: mca_io_base_file_select (in /usr/lib/openmpi/libmpi.so.40.0.0)
==15479==    by 0x146CEFB4: ompi_file_open (in /usr/lib/openmpi/libmpi.so.40.0.0)
==15479==    by 0x14725BA5: PMPI_File_open (in /usr/lib/openmpi/libmpi.so.40.0.0)
==15479==    by 0x375E1F2: H5FD_mpio_open (H5FDmpio.c:1058)
==15479==    by 0x37528B8: H5FD_open (H5FD.c:992)
==15479==    by 0x3746AA4: H5F_open (H5Fint.c:987)
==15479==    by 0x3740692: H5Fopen (H5F.c:603)
==15479==    by 0x21B3596: PetscViewerFileSetName_HDF5 (hdf5v.c:242)

We are not going to dig deeper into this becaus it seems not related to PetIBM.