julia icon indicating copy to clipboard operation
julia copied to clipboard

Valgrind reports memory leak in flisp

Open Keno opened this issue 10 years ago • 3 comments

I assume this may just be because flisp doesn't run finalizers in deinitialization, but just in case and for posterity, valgrind reports the following (found because address sanitizer complains as well):

valgrind --leak-check=full ./flisp/flisp /home/ubuntu/julia-gallium/src/mk_julia_flisp_boot.scm /home/ubuntu/julia-gallium/src/ jlfrontend.scm julia_flisp.boot
==7753== Memcheck, a memory error detector
==7753== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==7753== Using Valgrind-3.10.0.SVN and LibVEX; rerun with -h for copyright info
==7753== Command: ./flisp/flisp /home/ubuntu/julia-gallium/src/mk_julia_flisp_boot.scm /home/ubuntu/julia-gallium/src/ jlfrontend.scm julia_flisp.boot
==7753==
==7753==
==7753== HEAP SUMMARY:
==7753==     in use at exit: 11,295,048 bytes in 3,582 blocks
==7753==   total heap usage: 5,288 allocs, 1,706 frees, 20,212,763 bytes allocated
==7753==
==7753== 4,608 bytes in 4 blocks are definitely lost in loss record 203 of 228
==7753==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==7753==    by 0x41F746: equalhash_lookup_bp (equalhash.c:19)
==7753==    by 0x41F908: equalhash_put (equalhash.c:19)
==7753==    by 0x4201F6: fl_table_put (table.c:122)
==7753==    by 0x415992: apply_cl (flisp.c:1276)
==7753==    by 0x417AF2: do_trycatch (flisp.c:950)
==7753==    by 0x414E59: apply_cl (flisp.c:1856)
==7753==    by 0x417AF2: do_trycatch (flisp.c:950)
==7753==    by 0x414E59: apply_cl (flisp.c:1856)
==7753==    by 0x417AF2: do_trycatch (flisp.c:950)
==7753==    by 0x414E59: apply_cl (flisp.c:1856)
==7753==    by 0x417AF2: do_trycatch (flisp.c:950)
==7753==
==7753== LEAK SUMMARY:
==7753==    definitely lost: 4,608 bytes in 4 blocks
==7753==    indirectly lost: 0 bytes in 0 blocks
==7753==      possibly lost: 0 bytes in 0 blocks
==7753==    still reachable: 11,290,440 bytes in 3,578 blocks
==7753==         suppressed: 0 bytes in 0 blocks
==7753== Reachable blocks (those to which a pointer was found) are not shown.
==7753== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==7753==
==7753== For counts of detected and suppressed errors, rerun with: -v
==7753== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

Keno avatar Oct 11 '15 04:10 Keno

I think you're right that this is probably just due to not running finalizers on exit.

JeffBezanson avatar Oct 12 '15 04:10 JeffBezanson

Can we add a sanitizer/valgrind only codepath that calls the finalizers on exit?

Keno avatar Nov 02 '15 06:11 Keno

If someone is going to go to the effort of writing the code to call finalizers on exit, why wouldn't you run it unconditionally?

tkelman avatar Nov 02 '15 12:11 tkelman

Closed by #46249

inkydragon avatar Aug 13 '22 00:08 inkydragon