User talk:Philosopher/Nasal introspection: Difference between revisions

Jump to navigation Jump to search
m
No edit summary
Line 131: Line 131:


:::: I'll try that, since the issues don't go away when I delete the test namespace it's likely that I introduced a leak in the C side of things (which I still find odd). [[User:Philosopher|—Philosopher]] ([[User talk:Philosopher|talk]]) 00:07, 15 August 2013 (UTC)
:::: I'll try that, since the issues don't go away when I delete the test namespace it's likely that I introduced a leak in the C side of things (which I still find odd). [[User:Philosopher|—Philosopher]] ([[User talk:Philosopher|talk]]) 00:07, 15 August 2013 (UTC)
::::: It's been a while since I ran nasal in valgrind, but IIRC Andy never frees his naPools, so you may need to explicitly call free on each pool at the end to ensure that valgrind isn't getting confused by Nasal's very own memory management. In case of doubt, run first a simple hello world program via valgrind/nasal and check if the output makes sense, if it doesn't, it's because of the GC pools, which may not be explicitly freed by the program at termination (which isn't too uncommon, because programmers generally rely on the OS to reclaim all allocated memory). Okay, just tried it via the shell (valgrind nasal-bin hello.nas):
<pre>
var x=[1,2,3];
var h={1:,2:,3:};
var foo = "foo";
==29457== Memcheck, a memory error detector
==29457== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==29457== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for copyright info
==29457== Command: ./nasal-bin hello.nas
==29457==
==29457==
==29457== HEAP SUMMARY:
==29457==    in use at exit: 41,992 bytes in 81 blocks
==29457==  total heap usage: 255 allocs, 174 frees, 70,924 bytes allocated
==29457==
==29457== LEAK SUMMARY:
==29457==    definitely lost: 0 bytes in 0 blocks
==29457==    indirectly lost: 0 bytes in 0 blocks
==29457==      possibly lost: 7,408 bytes in 24 blocks
==29457==    still reachable: 34,584 bytes in 57 blocks
==29457==        suppressed: 0 bytes in 0 blocks
==29457== Rerun with --leak-check=full to see details of leaked memory
==29457==
==29457== For counts of detected and suppressed errors, rerun with: -v
==29457== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 4 from 4)
</pre>
BTW: Valgrind doesn't work too well with threads though ...


== Debugging Threads ==
== Debugging Threads ==

Navigation menu