Valgrind is amazing, even if you've never used it before it's basic usage is really simple: $ valgrind --tool=memcheck --leak-check=full /usr/bin/python ./test.py This is enough to point you at the places in your extension module where you allocated stuff that didn't get freed later. This is a massive timesaver with looking over the entire source file again to find out where you made your mistakes

