Message-Id: <3.0.6.32.19990824133643.009a89a0@mail.triode.net.au>
Date: Tue, 24 Aug 1999 13:36:43 +1000
To: caml-list@inria.fr
From: John Skaller <skaller@maxtal.com.au>
Subject: GC with finalisation?
I could use some advice on this. I'm implementing
a Python interpreter/compiler in Ocaml. Python class
instances support __del__ methods -- that is, destructors.
CPython uses reference counting for collection and finalisation.
JPython leverages Java's collector and finalisation semantics.
My current ocaml implementation leverages the ocaml collector,
which doesn't support finalisation (as far as I know).
I seem to have several choices.
1) implement reference counting for finalisation
* disadvantage: same problem as CPython: doesn't resolve
circular references properly
* disadvantage: overhead and coding complexity
* advantage: synchronous finalisation
2) Implement a full resource collector
* disadvantage: overhead and complexity
* disadvantage: probably won't support synchronous finalisation
3) provide BOTH reference counting and a collector (as Perl does)
* disadvantage: overhead and complexity
* advantage: finalises everything
* advantage: synchonous finalisation in all cases
that CPython provides it
I am interested in any comments on how to solve this problem.
Order of finalisation can be important in Python.
I have a major literate programming tool (Interscript) written in Python,
the compiler/interpreter is being built to make it go faster.
I use finalisation semantics extensively (tables of information
are generated at the end of document processing, etc).
While I might be able to rewrite it to avoid automatic finalisation,
it would be nice to support the wide class of other Python programs
that rely on it.
-------------------------------------------------------
John Skaller email: skaller@maxtal.com.au
http://www.maxtal.com.au/~skaller
phone: 61-2-96600850
snail: 10/1 Toxteth Rd, Glebe NSW 2037, Australia
This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:24 MET