Use __del__ methods to improve gc?

Duncan Booth duncan at NOSPAMrcp.co.uk
Thu Jun 12 15:06:18 CEST 2003


"Edward K. Ream" <edreamleo at charter.net> wrote in
news:vegt5ii1vo4v81 at corp.supernews.com: 

> 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?
> 
Remember the gc is generational. That means that any data that has survived 
a garbage collection is automatically excluded from most other garbage 
collections, so most of the time the grabage collector will ignore your 
user data objects anyway.

Or to put it another way, the garbage collector already knows not to look 
at your objects without your help.

-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?




More information about the Python-list mailing list