I have a long-running script which, if let to run long enough, will consume all the memory on my system.
Without going into details about the script, I have two questions:
Have a look at this article: Tracing python memory leaks
Also, note that the garbage collection module actually can have debug flags set. Look at the set_debug
function. Additionally, look at this code by Gnibbler for determining the types of objects that have been created after a call.