GC In Python: YAS (Yet Another Summary)

Stuart Yeates syeates at cs.waikato.ac.nz
Fri Jun 25 01:33:20 CEST 1999

Markus Kohler (markusk at bidra241.bbn.hp.com) wrote:

| The main problem with introducing a GC in Python is that a lot of C-code
| might directly point to Python objects which could be moved at runtime 
| by a state of the art GC  (generational mark and sweep + copying GC). 

[i'm coming at this from a GC point of view not a Python point of view]

There are two ways to handle this:
(a) instrument the python/c++ calling interface
(b) use a 'language independant' garbage collector such as the 
Boehm collector (http://reality.sgi.com/boehm_mti/gc.html). 

The Boehm collector is fast, efficient, portable across
hardware, portable across operating systems and portable 
across target languages. It does threads, finalisation etc

It fully supports C and C++ (and i believe one of the Java
implementation uses it). Because it allows continued use of
malloc/free new/delete it should be possible to build a 
system that recognises pointers from C++ to Python code.

Of course, if anything does pointer XORing or other crimes,
tools such as these are unavaliable.

--    stuart yeates <s.yeates at cs.waikato.ac.nz> aka `loam'
If you're not part of the solution, then you're part of the precipitate.

More information about the Python-list mailing list