Use __del__ methods to improve gc?

Tim Peters at
Fri Jun 13 03:20:13 CEST 2003

[Edward K. Ream]
> 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?

As others have explained, no, gc scans everything when it's time for it to
get scanned <wink>.  An interesting question may be why you suspect gc
*needs* help.  For example, is gc taking a lot of time in your app?

More information about the Python-list mailing list