★ wanayoo — archive 1999 http://www.acs.ucalgary.ca/~nascheme/python/gc.htmlNouvelle recherche | Portail wanayoo

Garbage Collection for Python

This patch adds garbage collection to Python 1.5.2c1. Reference counting is still used. The garbage collector only frees memory that the reference counting does not (ie. reference cycles). This seems to provide the best performance.

Currently the patch is only tested on Linux. It will probably work on other Unix machines as well. On my Linux machine, the GC version of Python passes all regession tests.

Sample usage:

	$ cd Python-1.5.2c1
	$ patch -p1 < ../gc-python-1.diff
	$ ./configure --with-gc

The patch assumes you have libgc.a installed somewhere so that linking with -lgc works (/usr/local/lib should be okay). If you don't have the library, download and install it before compiling.

If you are trying to fix a memory leaking Python program, Tim Peter's Cyclops module may also be useful. It is available on the Python ftp site.

You might also want to look at my portable garbage collection patch for Python.

Last update: Thu Feb 10 17:42:17 2000 Neil Schemenauer