Problem with garbage collection (sort of)
Michael Hudson
mwh at python.net
Mon Aug 18 10:59:25 EDT 2003
More information about the Python-list mailing list
Mon Aug 18 10:59:25 EDT 2003
- Previous message (by thread): Problem with garbage collection (sort of)
- Next message (by thread): Problem with garbage collection (sort of)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
frank at chagford.com (Frank Millman) writes: [...] > The problem is that class a keeps a reference to class b (self.b) and > class b keeps a reference to class a (self.p), so the reference counts > do not go down to zero without some additional action. Sure, but since 2.0, Python supplies that additional action itself... the problems are the __del__ methods. This must be documented somewhere... ah, here: http://www.python.org/doc/current/ref/customization.html#l2h-175 though that's not totally clear. Basically, a cycle will not be cleared if one of the objects making up the cycle has a __del__ method. Sometimes it is possible to arrange things so only "leaf" objects have __del__ methods, then all this ceases to be a problem. Cheers, mwh -- I think my standards have lowered enough that now I think ``good design'' is when the page doesn't irritate the living fuck out of me. -- http://www.jwz.org/gruntle/design.html
- Previous message (by thread): Problem with garbage collection (sort of)
- Next message (by thread): Problem with garbage collection (sort of)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list