[petsc-users] Unexplained memory leaks

baikadi pranay pranayreddy865 at gmail.com
Fri Aug 28 03:30:01 CDT 2020


Hi,
I am building a 2D solver for the semiconductor Poisson-Boltzmann equation.
I detected a memory leak when running the program using valgrind but I am
unable to solve this issue as there are no signs in the valgrind output
indicating that the source of the error is in the modules I have written. I
am attaching you a text file containing the valgrind output.

I have seen that a similar question was asked earlier (found here
<https://lists.mcs.anl.gov/pipermail/petsc-users/2010-October/007132.html>)
but I could not find a final solution to that problem. Could you let me
know the source of the problem?

Please let me know if you need any further information.

Thank you,
Pranay.
ᐧ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200828/6b09bbcf/attachment.html>
-------------- next part --------------
==3496== HEAP SUMMARY
==3496==     in use at exit 13,861,509 bytes in 89 blocks
==3496==   total heap usage 23,885 allocs, 23,796 frees, 67,052,683 bytes allocated
==3496==
==3496== 5 bytes in 1 blocks are definitely lost in loss record 1 of 89
==3496==    at 0x4C29BE3 malloc (vg_replace_malloc.c299)
==3496==    by 0x9863949 strdup (in usrlib64libc-2.17.so)
==3496==    by 0xEAA7DDF 
==3496==    by 0xE872782 
==3496==    by 0xE879DB0 
==3496==    by 0xE8700FE 
==3496==    by 0xE82C6A5 
==3496==    by 0xE5EB5F3 
==3496==    by 0xDFD78FA 
==3496==    by 0x9DE3000 orte_init (in packages7xopenmpiagave3.0.0gcc6xnormalliblibopen-rte.so.40.0.0)
==3496==    by 0x8EA28DD ompi_mpi_init (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi.so.40.0.0)
==3496==    by 0x8EC8C7A PMPI_Init (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi.so.40.0.0)
==3496==
==3496== 5 bytes in 1 blocks are definitely lost in loss record 2 of 89
==3496==    at 0x4C29BE3 malloc (vg_replace_malloc.c299)
==3496==    by 0x9863949 strdup (in usrlib64libc-2.17.so)
==3496==    by 0xEAA7D87 
==3496==    by 0xE872782 
==3496==    by 0xE879DB0 
==3496==    by 0xE8700FE 
==3496==    by 0xE82C6A5 
==3496==    by 0xE5EB5F3 
==3496==    by 0xDFD78FA 
==3496==    by 0x9DE3000 orte_init (in packages7xopenmpiagave3.0.0gcc6xnormalliblibopen-rte.so.40.0.0)
==3496==    by 0x8EA28DD ompi_mpi_init (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi.so.40.0.0)
==3496==    by 0x8EC8C7A PMPI_Init (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi.so.40.0.0)
==3496==
==3496== 8 bytes in 1 blocks are definitely lost in loss record 3 of 89
==3496==    at 0x4C2B975 calloc (vg_replace_malloc.c711)
==3496==    by 0xA0E9773 dlopen_open (in packages7xopenmpiagave3.0.0gcc6xnormalliblibopen-pal.so.40.0.0)
==3496==    by 0x12824C63 
==3496==    by 0x134516CF 
==3496==    by 0xA0C92D2 mca_base_framework_components_open (in packages7xopenmpiagave3.0.0gcc6xnormalliblibopen-pal.so.40.0.0)
==3496==    by 0xA0E773A mca_btl_base_open (in packages7xopenmpiagave3.0.0gcc6xnormalliblibopen-pal.so.40.0.0)
==3496==    by 0xA0D3C90 mca_base_framework_open (in packages7xopenmpiagave3.0.0gcc6xnormalliblibopen-pal.so.40.0.0)
==3496==    by 0xA0D3C90 mca_base_framework_open (in packages7xopenmpiagave3.0.0gcc6xnormalliblibopen-pal.so.40.0.0)
==3496==    by 0x8EA2E6C ompi_mpi_init (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi.so.40.0.0)
==3496==    by 0x8EC8C7A PMPI_Init (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi.so.40.0.0)
==3496==    by 0x8C463E7 MPI_INIT (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi_mpifh.so.40.0.0)
==3496==    by 0x4F8AF56 petscinitialize_internal (zstart.c317)
==3496==
==3496== 8 bytes in 1 blocks are definitely lost in loss record 4 of 89
==3496==    at 0x4C2B975 calloc (vg_replace_malloc.c711)
==3496==    by 0xA0E9773 dlopen_open (in packages7xopenmpiagave3.0.0gcc6xnormalliblibopen-pal.so.40.0.0)
==3496==    by 0x12824C63 
==3496==    by 0x13AA05E9 
==3496==    by 0xA0E7B25 mca_btl_base_select (in packages7xopenmpiagave3.0.0gcc6xnormalliblibopen-pal.so.40.0.0)
==3496==    by 0x12E35491 
==3496==    by 0x8EEC95B mca_bml_base_init (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi.so.40.0.0)
==3496==    by 0x8EA2E8B ompi_mpi_init (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi.so.40.0.0)
==3496==    by 0x8EC8C7A PMPI_Init (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi.so.40.0.0)
==3496==    by 0x8C463E7 MPI_INIT (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi_mpifh.so.40.0.0)
==3496==    by 0x4F8AF56 petscinitialize_internal (zstart.c317)
==3496==    by 0x4F8B996 petscinitialize_ (zstart.c504)
==3496==
==3496== 8 bytes in 1 blocks are definitely lost in loss record 5 of 89
==3496==    at 0x4C2B975 calloc (vg_replace_malloc.c711)
==3496==    by 0xA0E9773 dlopen_open (in packages7xopenmpiagave3.0.0gcc6xnormalliblibopen-pal.so.40.0.0)
==3496==    by 0x12824C63 
==3496==    by 0x13EAF2F3 
==3496==    by 0xA0E7B25 mca_btl_base_select (in packages7xopenmpiagave3.0.0gcc6xnormalliblibopen-pal.so.40.0.0)
==3496==    by 0x12E35491 
==3496==    by 0x8EEC95B mca_bml_base_init (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi.so.40.0.0)
==3496==    by 0x8EA2E8B ompi_mpi_init (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi.so.40.0.0)
==3496==    by 0x8EC8C7A PMPI_Init (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi.so.40.0.0)
==3496==    by 0x8C463E7 MPI_INIT (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi_mpifh.so.40.0.0)
==3496==    by 0x4F8AF56 petscinitialize_internal (zstart.c317)
==3496==    by 0x4F8B996 petscinitialize_ (zstart.c504)
==3496==
==3496== 12 bytes in 1 blocks are definitely lost in loss record 6 of 89
==3496==    at 0x4C29BE3 malloc (vg_replace_malloc.c299)
==3496==    by 0x9863949 strdup (in usrlib64libc-2.17.so)
==3496==    by 0xEAABCFD 
==3496==    by 0xE882357 
==3496==    by 0xE82C925 
==3496==    by 0xE5EB5F3 
==3496==    by 0xDFD78FA 
==3496==    by 0x9DE3000 orte_init (in packages7xopenmpiagave3.0.0gcc6xnormalliblibopen-rte.so.40.0.0)
==3496==    by 0x8EA28DD ompi_mpi_init (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi.so.40.0.0)
==3496==    by 0x8EC8C7A PMPI_Init (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi.so.40.0.0)
==3496==    by 0x8C463E7 MPI_INIT (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi_mpifh.so.40.0.0)
==3496==    by 0x4F8AF56 petscinitialize_internal (zstart.c317)
==3496==
==3496== 13 bytes in 1 blocks are definitely lost in loss record 7 of 89
==3496==    at 0x4C29BE3 malloc (vg_replace_malloc.c299)
==3496==    by 0x9863949 strdup (in usrlib64libc-2.17.so)
==3496==    by 0x12824CFF 
==3496==    by 0x134516CF 
==3496==    by 0xA0C92D2 mca_base_framework_components_open (in packages7xopenmpiagave3.0.0gcc6xnormalliblibopen-pal.so.40.0.0)
==3496==    by 0xA0E773A mca_btl_base_open (in packages7xopenmpiagave3.0.0gcc6xnormalliblibopen-pal.so.40.0.0)
==3496==    by 0xA0D3C90 mca_base_framework_open (in packages7xopenmpiagave3.0.0gcc6xnormalliblibopen-pal.so.40.0.0)
==3496==    by 0xA0D3C90 mca_base_framework_open (in packages7xopenmpiagave3.0.0gcc6xnormalliblibopen-pal.so.40.0.0)
==3496==    by 0x8EA2E6C ompi_mpi_init (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi.so.40.0.0)
==3496==    by 0x8EC8C7A PMPI_Init (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi.so.40.0.0)
==3496==    by 0x8C463E7 MPI_INIT (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi_mpifh.so.40.0.0)
==3496==    by 0x4F8AF56 petscinitialize_internal (zstart.c317)
==3496==
==3496== 13 bytes in 1 blocks are definitely lost in loss record 8 of 89
==3496==    at 0x4C29BE3 malloc (vg_replace_malloc.c299)
==3496==    by 0x9863949 strdup (in usrlib64libc-2.17.so)
==3496==    by 0x12824CFF 
==3496==    by 0x13AA05E9 
==3496==    by 0xA0E7B25 mca_btl_base_select (in packages7xopenmpiagave3.0.0gcc6xnormalliblibopen-pal.so.40.0.0)
==3496==    by 0x12E35491 
==3496==    by 0x8EEC95B mca_bml_base_init (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi.so.40.0.0)
==3496==    by 0x8EA2E8B ompi_mpi_init (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi.so.40.0.0)
==3496==    by 0x8EC8C7A PMPI_Init (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi.so.40.0.0)
==3496==    by 0x8C463E7 MPI_INIT (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi_mpifh.so.40.0.0)
==3496==    by 0x4F8AF56 petscinitialize_internal (zstart.c317)
==3496==    by 0x4F8B996 petscinitialize_ (zstart.c504)
==3496==
==3496== 13 bytes in 1 blocks are definitely lost in loss record 9 of 89
==3496==    at 0x4C29BE3 malloc (vg_replace_malloc.c299)
==3496==    by 0x9863949 strdup (in usrlib64libc-2.17.so)
==3496==    by 0x12824CFF 
==3496==    by 0x13EAF2F3 
==3496==    by 0xA0E7B25 mca_btl_base_select (in packages7xopenmpiagave3.0.0gcc6xnormalliblibopen-pal.so.40.0.0)
==3496==    by 0x12E35491 
==3496==    by 0x8EEC95B mca_bml_base_init (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi.so.40.0.0)
==3496==    by 0x8EA2E8B ompi_mpi_init (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi.so.40.0.0)
==3496==    by 0x8EC8C7A PMPI_Init (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi.so.40.0.0)
==3496==    by 0x8C463E7 MPI_INIT (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi_mpifh.so.40.0.0)
==3496==    by 0x4F8AF56 petscinitialize_internal (zstart.c317)
==3496==    by 0x4F8B996 petscinitialize_ (zstart.c504)
==3496==
==3496== 29 bytes in 1 blocks are definitely lost in loss record 14 of 89
==3496==    at 0x4C29BE3 malloc (vg_replace_malloc.c299)
==3496==    by 0x9863949 strdup (in usrlib64libc-2.17.so)
==3496==    by 0xF2BBCE7 
==3496==    by 0x400F4C2 _dl_init (in usrlib64ld-2.17.so)
==3496==    by 0x4013BD5 dl_open_worker (in usrlib64ld-2.17.so)
==3496==    by 0x400F2D3 _dl_catch_error (in usrlib64ld-2.17.so)
==3496==    by 0x40132CA _dl_open (in usrlib64ld-2.17.so)
==3496==    by 0x85C8FBA dlopen_doit (in usrlib64libdl-2.17.so)
==3496==    by 0x400F2D3 _dl_catch_error (in usrlib64ld-2.17.so)
==3496==    by 0x85C95BC _dlerror_run (in usrlib64libdl-2.17.so)
==3496==    by 0x85C9050 dlopen@@GLIBC_2.2.5 (in usrlib64libdl-2.17.so)
==3496==    by 0xE87A5C1 
==3496==
==3496== 56 bytes in 1 blocks are definitely lost in loss record 60 of 89
==3496==    at 0x4C29BE3 malloc (vg_replace_malloc.c299)
==3496==    by 0x11965489 
==3496==    by 0x117539A4 
==3496==    by 0x11544C25 
==3496==    by 0x9E33E3C orte_oob_base_select (in packages7xopenmpiagave3.0.0gcc6xnormalliblibopen-rte.so.40.0.0)
==3496==    by 0x9E23074 orte_ess_base_app_setup (in packages7xopenmpiagave3.0.0gcc6xnormalliblibopen-rte.so.40.0.0)
==3496==    by 0xDFD786A 
==3496==    by 0x9DE3000 orte_init (in packages7xopenmpiagave3.0.0gcc6xnormalliblibopen-rte.so.40.0.0)
==3496==    by 0x8EA28DD ompi_mpi_init (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi.so.40.0.0)
==3496==    by 0x8EC8C7A PMPI_Init (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi.so.40.0.0)
==3496==    by 0x8C463E7 MPI_INIT (in packages7xopenmpiagave3.0.0gcc6xnormalliblibmpi_mpifh.so.40.0.0)
==3496==    by 0x4F8AF56 petscinitialize_internal (zstart.c317)
==3496==
==3496== 536 (24 direct, 512 indirect) bytes in 1 blocks are definitely lost in loss record 64 of 89
==3496==    at 0x4C29BE3 malloc (vg_replace_malloc.c299)
==3496==    by 0x78FC2F4 _gfortrani_xmalloc (memory.c43)
==3496==    by 0x79CC48A _gfortrani_fbuf_init (fbuf.c42)
==3496==    by 0x79BD0C6 _gfortrani_new_unit (open.c615)
==3496==    by 0x79BD70D already_open (open.c672)
==3496==    by 0x79BD70D _gfortran_st_open (open.c837)
==3496==    by 0x41D901 __poisson_petsc_MOD_find_profile (poisson_PETSc.F90496)
==3496==    by 0x41E5D8 MAIN__ (main.F9021)
==3496==    by 0x41E60E main (main.F902)
==3496==
==3496== 1,640 (320 direct, 1,320 indirect) bytes in 1 blocks are definitely lost in loss record 67 of 89
==3496==    at 0x4C2BB78 realloc (vg_replace_malloc.c785)
==3496==    by 0xE813563 
==3496==    by 0xE81C77D 
==3496==    by 0xA0EE0C7 event_process_active_single_queue (event.c1370)
==3496==    by 0xA0EE0C7 event_process_active (event.c1440)
==3496==    by 0xA0EE0C7 opal_libevent2022_event_base_loop (event.c1644)
==3496==    by 0xE8703CD 
==3496==    by 0x95C8E24 start_thread (in usrlib64libpthread-2.17.so)
==3496==    by 0x98D534C clone (in usrlib64libc-2.17.so)
==3496==
==3496== LEAK SUMMARY
==3496==    definitely lost 514 bytes in 13 blocks
==3496==    indirectly lost 1,832 bytes in 36 blocks
==3496==      possibly lost 0 bytes in 0 blocks
==3496==    still reachable 13,859,163 bytes in 40 blocks
==3496==         suppressed 0 bytes in 0 blocks
==3496== Reachable blocks (those to which a pointer was found) are not shown.
==3496== To see them, rerun with --leak-check=full --show-leak-kinds=all
==3496==
==3496== For counts of detected and suppressed errors, rerun with -v
==3496== ERROR SUMMARY 13 errors from 13 contexts (suppressed 0 from 0)


More information about the petsc-users mailing list