Ich schreibe eine Python-Erweiterung, die Speicher zu verlieren scheint. Ich versuche, das Problem mit Valgrind zu lösen.Python Speicherlecks?
Es scheint jedoch, dass Python selbst Speicher nach Valgrind undicht ist. Mit dem folgenden einfachen Skript:
hello.py
print "Hello World!"
und
> valgrind --tool=memcheck python ./hello.py
(...)
==7937== ERROR SUMMARY: 580 errors from 34 contexts (suppressed: 21 from 1)
==7937== malloc/free: in use at exit: 721,878 bytes in 190 blocks.
==7937== malloc/free: 2,436 allocs, 2,246 frees, 1,863,631 bytes allocated.
==7937== For counts of detected errors, rerun with: -v
==7937== Use --track-origins=yes to see where uninitialised values come from
==7937== searching for pointers to 190 not-freed blocks.
==7937== checked 965,952 bytes.
==7937==
==7937== LEAK SUMMARY:
==7937== definitely lost: 0 bytes in 0 blocks.
==7937== possibly lost: 4,612 bytes in 13 blocks.
==7937== still reachable: 717,266 bytes in 177 blocks.
==7937== suppressed: 0 bytes in 0 blocks.
==7937== Rerun with --leak-check=full to see details of leaked memory.
Hat jemand eine Erklärung für dieses Verhalten strage tun? Gibt der Python-Interpreter wirklich Speicher frei?
Welches Tool verwenden Python-Entwickler, um ihre Speicherlecks zu debuggen?