From: Markus Mottl <mottl@miss.wu-wien.ac.at>
To: David.Mentre@irisa.fr (David Mentré)
Cc: caml-list@inria.fr (OCAML)
Subject: Re: Still strange GC problems with OCaml and C: OCaml 2.04 bug?
Date: Mon, 21 Feb 2000 21:10:34 +0100 (MET) [thread overview]
Message-ID: <200002212010.VAA07719@miss.wu-wien.ac.at> (raw)
In-Reply-To: <wd8n1ou3aw5.fsf@parate.irisa.fr> from "David=?iso-8859-1?q?_Mentr=E9?=" at Feb 21, 2000 03:09:30 PM
> I'm still fighting against my bug while trying to interface OCaml with
> CMU bdd library (in C).
Hm, I have just taken a look at the code. I do not want to be too fast with
my suggestion (I have not tried it), but I am pretty sure that the
following might be the bug:
You use "Store_field" throughout the code to assign pointers to fields in
structures which were allocated using "alloc_final".
I once had a similar bug in my PCRE-library, but Gerd Stolpmann was so kind
to send me the patch and explain the problem. Here his translated
explanation (seems reasonable):
- after "alloc_small" the fields have to be initialized with
"Field(var, n) = ...", not with "Store_field". The last version writes
(with some bad luck) the address of the field into a list of addresses
which have to be moved in case of a minor GC.
- The fields of "alloc_final" are not considered by the GC. Therefore,
they, too, have to be written to using "Field(var, n)" (or you may
cast them to a normal C-struct). "Store_field" has, again, unexpected
side effects.
Since you are lucky and have used access macros throughout the code, you
can quickly test my suggestion by changing them.
I hope that helps!
In case this is really the bug (probably), I'd suggest a revision of the
C-interface-documentation. At least to me it was not obvious that
"Store_field" leads to such additional, unexpected behaviour.
Good luck squeezing the bug,
Markus Mottl
--
Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl
next prev parent reply other threads:[~2000-02-22 10:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-02-21 14:09 David Mentré
2000-02-21 20:10 ` Markus Mottl [this message]
2000-02-22 9:16 ` Congratulation! Bug found!! (GC & C interfacing problems) David Mentré
2000-02-22 16:27 ` Markus Mottl
2000-02-21 18:29 Still strange GC problems with OCaml and C: OCaml 2.04 bug? Manuel Fahndrich
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=200002212010.VAA07719@miss.wu-wien.ac.at \
--to=mottl@miss.wu-wien.ac.at \
--cc=David.Mentre@irisa.fr \
--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