Every XS authors should use Test::Valgrind Test::Valgrind is a perl wrapper for valgrind(1). T::V helps to find invalid memory operation. You can use it by command line like following: prove --exec 'perl -Iblib/lib -Iblib/arch -MTest::Valgrind' t/*.t Or use it as test script. You can put it on xt/. use Test::More; use Test::Requires 'Test::Valgrind'; leaky(); Latest stable version of valgrind is n