Python 2.0

adjih at technologist.com adjih at technologist.com
Thu Jun 3 14:35:51 CEST 1999


In article <7j450j$908$2 at cronkite.cc.uga.edu>,
  graham at sloth.math.uga.edu (Graham Matthews) wrote:
> Martijn Faassen (faassen at pop.vet.uu.nl) wrote:
> : This sounds like an interesting idea; I believe I saw references to
> : garbage collecting schemes that help clean up circular references
caused
> : by referencing counting. I forget where, though. :)
>
> Here. I posted comments in this thread and in a similar thread about
> such systems. They are generally all variations on mark and sweep
> collection. The more efficient ones use colouring.
>
> Martijn Faassen (faassen at pop.vet.uu.nl) wrote:
> : * In the complex case, garbage collecting is nice as it cleans up
> : circular references. There are unwanted side-effects of its
> : unpredictability, though; a possible leaking of resources (files
which
> : aren't closed), and some difficulties interfacing with C.
>
> I don't buy either of these difficulties since I have worked with and
> implemented systems which have full garbage collection and have no
> problems interfacing to C, or dealing with resources like files.

  But there will be cases where full garbage collection will be
definitly a nuisance.
  First, you must scan all the address space of the C code, which can be
a problem if you're just using the Python interpreter in a library (i.e.
don't have the ability to control or modifying the main program) ; or if
your address space is too big (I use python for instance in a program
that does an mmap of a 350 MB file).
  Second you kill the portability: you could use a subset of Python with
ANSI-C alone ; but you can't make a incremental GC in ANSI-C.
  You'd get problems when embedding Python in unusual environments ; for
instance if you embed Python in the Linux kernel, then the GC should
also trace all the pages in the swap, or be rewritten specially for that
case.

  The advantages of GC must be traded with its drawbacks:
- advantages: reclaims cyclic structures.
- drawbacks: non-portable, requires a special handling when linking with
C, high complexity for decent GC (multi-thread incremental with
finalization and support for C/C++ structures referencing Python
structures).


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




More information about the Python-list mailing list