Use __del__ methods to improve gc?

Andrew Bennetts andrew-pythonlist at puzzling.org
Thu Jun 12 20:52:27 EDT 2003


On Thu, Jun 12, 2003 at 07:35:43AM -0500, Edward K. Ream wrote:
> My app has unlimited undo.  As a result, most "user" data never truly gets
> deleted: the undo stack keeps references to all such data alive "forever".
> 
> I am wondering whether it would be a good idea to put dummy __del__ methods
> in the user data classes.  Would this help the gc by telling the gc what not
> to look at?

No.  In fact, it would probably have the opposite effect; __del__ methods
can prevent unreachable cycles from being collected.

However, it sounds like you might be interested in the weakref module...

-Andrew.






More information about the Python-list mailing list