Doesn't adding the gc.collect() just force the garbage collector to run 
right now instead of waiting until some usage threshold is crossed and then 
it runs to do the cleanup at some time in the future. Any accumulation of 
heap use until gc gets around to running isn't really a leak, it is just 
uncollected garbage. The __del__ doesn't do anything and also doesn't force 
a gc.collect() by its presence.

http://www.algorithm.co.il/blogs/programming/python-gotchas-1-__del__-is-not-the-opposite-of-__init__/

Reply via email to