Add memory leak tracing (Pull request 407)