GC...

David Arnold arnold at dstc.monash.edu.au
Sun May 7 03:34:03 EDT 2000


-->"Courageous" == Courageous  <jkraska1 at san.rr.com> writes:

  Courageous> If two python objects mutally refer to eachother, but
  Courageous> aren't referred to globally in any current namespace,
  Courageous> will they be garbage collected?

no.

in JPython, this is not true, because it uses Java's garbage
collection underneath.  and there are at least two different patch
sets for CPython that provide garbage collection unaffected by cyclic
references.  but in standard CPython 1.5.2, such references prevent
the reference counting from collecting the involved objects.

the only solution (aside from avoiding the problem) is to provide an
explicit destroy/close method for at least one of the classes, and
use it to break the cycle.



d




More information about the Python-list mailing list