Circular references and python
Neel Krishnaswami
neelk at brick.cswv.com
Wed Feb 2 19:01:06 EST 2000
Jason Stokes <jstok at bluedog.apana.org.au> wrote:
> Well, my adventures with the Python language are moving along. One thing
> that worries me is the lack of garbage collection in Python; the application
> I'm thinking of using Python for demands many data structures that use
> circular references, but Python only implements a reference counting scheme
> in the way of memory management. How do I use such data structures in
> Python?
Apply Neil Schemenauer's patches that convinces Python to use the
Boehm garbage collector, or just live with the garbage, if your
program is relatively short-lived. You can find his patch at:
http://www.acs.ucalgary.ca/~nascheme/python/gc.html
Manually freeing memory is ugly and error-prone. Don't do it. :)
Neel
More information about the Python-list
mailing list