From: Markus Mottl <mottl@miss.wu-wien.ac.at>
To: skaller@maxtal.com.au (John Skaller)
Cc: caml-list@inria.fr (OCAML)
Subject: Re: GC with finalisation?
Date: Thu, 26 Aug 1999 22:09:32 +0100 (MET DST) [thread overview]
Message-ID: <199908262009.WAA29246@miss.wu-wien.ac.at> (raw)
In-Reply-To: <3.0.6.32.19990824133643.009a89a0@mail.triode.net.au> from "John Skaller" at Aug 24, 99 01:36:43 pm
> 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
The main problem with reference counting is speed. It is possible to
resolve circular references in linear time, but the constant overhead
and the associated memory requirements are simply too large.
Anyway, there is a nice fortune cookie pointing out potential problems
with recursive datastructures when doing reference counting:
One day a student came to Moon and said, "I understand how to make
a better garbage collector. We must keep a reference count of the
pointers to each cons."
Moon patiently told the student the following story -- "One day a
student came to Moon and said, "I understand how to make a better
garbage collector..."
[snip GC approaches]
I would leave all the work to the OCaml-GC: use module "Weak" to register
values (eg.: objects) to be finalized. Then check these arrays from
time to time and call appropriate finalization functions for objects
that have been reclaimed.
Regards,
Markus
--
Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl
next prev parent reply other threads:[~1999-08-28 17:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-08-24 3:36 John Skaller
1999-08-26 21:09 ` Markus Mottl [this message]
1999-08-27 5:10 ` John Skaller
1999-08-27 7:13 ` STARYNKEVITCH Basile
1999-08-28 4:29 ` John Skaller
1999-08-28 21:49 ` Markus Mottl
[not found] <3.0.6.32.19990830144523.00964e20@mail.triode.net.au>
1999-08-30 12:31 ` Markus Mottl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199908262009.WAA29246@miss.wu-wien.ac.at \
--to=mottl@miss.wu-wien.ac.at \
--cc=caml-list@inria.fr \
--cc=skaller@maxtal.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox