From: skaller <skaller@maxtal.com.au>
To: caml-list@inria.fr
Subject: Finalisation patch
Date: Mon, 17 Jan 2000 07:40:01 +1100 [thread overview]
Message-ID: <38822CA1.34B93687@maxtal.com.au> (raw)
In finalise.c (ocaml 2.999 :-) the code is arranged to call finalisers
in order that they're specified by the client, which is usually
the _wrong_ order. If you consider some object P with a pointer
to an object C, usually C will be constructed first, then P.
This would call a finaliser on C before a finaliser on P,
which is wrong.
This particular problem is easily fixed by scanning
old values in 'final_update' in reverse order.
Unfortunately, while that will work in many cases,
it will not work when a child of an object (which must
always be finalised after the parent) is constructed
after the parent.
What we need here is a way for the client to specify
the order of finalisation, if the default first in last out
(stack) order is incorrect.
I think we can consider the problem in terms of an
graph of finalisers [invocations of Gc.finalise].
There is a problem here, though: the client cannot
access the finalisers, except when Gc.finalise is called.
Hmmm. I'll have to think on this. At a minimum, acyclic
dependencies between objects must be correctly resolved.
[This is far from perfect, but much better than the current
scheme which is more often wrong than not]
--
John (Max) Skaller, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
homepage: http://www.maxtal.com.au/~skaller
download: ftp://ftp.cs.usyd.edu/au/jskaller
reply other threads:[~2000-01-16 21:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=38822CA1.34B93687@maxtal.com.au \
--to=skaller@maxtal.com.au \
--cc=caml-list@inria.fr \
/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;
as well as URLs for NNTP newsgroup(s).