I have created some python code which creates an object in a loop, and in every iteration overwrites this object with a new one of the same type. This is done 10.000 times,
I found that in my case (with Python 2.5.1), with circular references involving classes that have __del__()
methods, not only was garbage collection not happening in a timely manner, the __del__()
methods of my objects were never getting called, even when the script exited. So I used weakref to break the circular references and all was well.
Kudos to Miles who provided all the information in his comments for me to put this together.