[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | John Skaller <skaller@m...> |
| 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