Properly Using 3.4.1 & Valgrind

Jeremy Moles cubicool at
Thu Sep 18 00:45:04 CEST 2014

Hey guys. I'm using the Python 3.4.1 release tarball, and am trying to configure it for usage with valgrind. I have followed all of the common, well-documented steps online such as uncommenting Py_USING_MEMORY_DEBUGGER, compiling with --with-pydebug, --with-valgrind, and --without-pymalloc. I've tried uncommenting everything in the provided suppression file, as well.

However, no matter what I do with my configuration/build, I cannot get Python to stop reporting thousands of lines of leaks. In fact, every call to Py_MALLOC results in valgrind believing a leak has occurred, so you can imagine there would be a legion of errors just firing up the interpreter.

What is the modern, accepted way of using Python3 with valgrind, and what should my expectations be? I really like relying on Valgrind as an additional source of informative debugging information (though not exclusively), and any help resolving this would be appreciated.

At a minimum, I'd expect simply opening/closing the interpreter to generate no leak warnings. I'm perfectly fine making suppression files for small issues here or there (especially in libraries/modules), but I find it hard to believe a project as well-maintained as Python has this many "valid" leaks. I'm pretty sure the problem is me. :)


More information about the Python-list mailing list