
Nov. 7, 2013
9:29 a.m.
I've been investigating a memory leak in an application that makes very heavy use of lxml, and I would be delighted if this was the cause.
In my case it took ages to track down because the memory leak didn't seem to appear when the code was single threaded. If it's any use to you I found the easiest way was to have a little test.py script that called the offending code several thousand times and a separate window checking the memory usage (on Linux you can use something like this: while true; do ps auxw | grep test.py | grep -v "grep"; sleep 1; done ) Then when you run test.py you can easily see if the memory consumption is going up or staying fairly static. It's a right pain but it does allow you to narrow down the cause fairly quickly.