Core leak, detected, fix on the way I guess.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Core leak, detected, fix on the way I guess.

emacstheviking
Under Ubuntu 14.04, with a debug build of gprolog and valgrind I got this after loading an empty source file:

==8418== 
==8418== HEAP SUMMARY:
==8418==     in use at exit: 911,183 bytes in 1,994 blocks
==8418==   total heap usage: 2,042 allocs, 48 frees, 920,804 bytes allocated
==8418== 
==8418== 16 bytes in 1 blocks are definitely lost in loss record 7 of 1,994
==8418==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8418==    by 0x51C5839: strdup (strdup.c:42)
==8418==    by 0x4A33DD: Pl_M_Tempnam (in /usr/local/gprolog-1.4.4/bin/gprolog)
==8418==    by 0x4805ED: Pl_Temporary_File_3 (in /usr/local/gprolog-1.4.4/bin/gprolog)
==8418==    by 0x47D575: ??? (in /usr/local/gprolog-1.4.4/bin/gprolog)
==8418==    by 0x4A46B1: Call_Next (in /usr/local/gprolog-1.4.4/bin/gprolog)
==8418==    by 0x4A52C2: Pl_Call_Prolog (in /usr/local/gprolog-1.4.4/bin/gprolog)
==8418==    by 0x403477: main (in /usr/local/gprolog-1.4.4/bin/gprolog)
==8418== 
==8418== LEAK SUMMARY:
==8418==    definitely lost: 16 bytes in 1 blocks
==8418==    indirectly lost: 0 bytes in 0 blocks
==8418==      possibly lost: 0 bytes in 0 blocks
==8418==    still reachable: 911,167 bytes in 1,993 blocks
==8418==         suppressed: 0 bytes in 0 blocks
==8418== Reachable blocks (those to which a pointer was found) are not shown.
==8418== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==8418== 
==8418== For counts of detected and suppressed errors, rerun with: -v
==8418== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)


So, there is a leak across the board not just OSX...
I am going to read the source and use the force to see if I can fix this one, I mean, how hard could it be it even tells me where to look!



_______________________________________________
Users-prolog mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/users-prolog
Reply | Threaded
Open this post in threaded view
|

Re: Core leak, detected, fix on the way I guess.

Daniel Diaz-3
Hi,

When you consult a file an atom is created corresponding to the temporary file name (something like /tmp/gplc...). Since, there is no
garbage collector for atoms this is never recovered. You can use :

?- statistics.
Memory               limit         in use            free

   trail  stack      16383 Kb            0 Kb        16383 Kb
   cstr   stack      16384 Kb            0 Kb        16384 Kb
   global stack      32767 Kb            2 Kb        32765 Kb
   local  stack      16383 Kb            0 Kb        16383 Kb
   atom   table      32768 atoms      1764 atoms     31004 atoms

to see the number of atoms in use (it should increase at each consult I suppose).

Daniel


Le 11/03/2016 15:13, emacstheviking a écrit :
Under Ubuntu 14.04, with a debug build of gprolog and valgrind I got this after loading an empty source file:

==8418== 
==8418== HEAP SUMMARY:
==8418==     in use at exit: 911,183 bytes in 1,994 blocks
==8418==   total heap usage: 2,042 allocs, 48 frees, 920,804 bytes allocated
==8418== 
==8418== 16 bytes in 1 blocks are definitely lost in loss record 7 of 1,994
==8418==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8418==    by 0x51C5839: strdup (strdup.c:42)
==8418==    by 0x4A33DD: Pl_M_Tempnam (in /usr/local/gprolog-1.4.4/bin/gprolog)
==8418==    by 0x4805ED: Pl_Temporary_File_3 (in /usr/local/gprolog-1.4.4/bin/gprolog)
==8418==    by 0x47D575: ??? (in /usr/local/gprolog-1.4.4/bin/gprolog)
==8418==    by 0x4A46B1: Call_Next (in /usr/local/gprolog-1.4.4/bin/gprolog)
==8418==    by 0x4A52C2: Pl_Call_Prolog (in /usr/local/gprolog-1.4.4/bin/gprolog)
==8418==    by 0x403477: main (in /usr/local/gprolog-1.4.4/bin/gprolog)
==8418== 
==8418== LEAK SUMMARY:
==8418==    definitely lost: 16 bytes in 1 blocks
==8418==    indirectly lost: 0 bytes in 0 blocks
==8418==      possibly lost: 0 bytes in 0 blocks
==8418==    still reachable: 911,167 bytes in 1,993 blocks
==8418==         suppressed: 0 bytes in 0 blocks
==8418== Reachable blocks (those to which a pointer was found) are not shown.
==8418== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==8418== 
==8418== For counts of detected and suppressed errors, rerun with: -v
==8418== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)


So, there is a leak across the board not just OSX...
I am going to read the source and use the force to see if I can fix this one, I mean, how hard could it be it even tells me where to look!




_______________________________________________
Users-prolog mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/users-prolog


_______________________________________________
Users-prolog mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/users-prolog