From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA16201 for caml-redistribution; Tue, 22 Feb 2000 11:47:35 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA01850 for ; Mon, 21 Feb 2000 21:10:42 +0100 (MET) Received: from miss.wu-wien.ac.at (miss.wu-wien.ac.at [137.208.107.17]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id VAA16416 for ; Mon, 21 Feb 2000 21:10:41 +0100 (MET) Received: (from mottl@localhost) by miss.wu-wien.ac.at (8.9.0/8.9.0) id VAA07719; Mon, 21 Feb 2000 21:10:34 +0100 (MET) From: Markus Mottl Message-Id: <200002212010.VAA07719@miss.wu-wien.ac.at> Subject: Re: Still strange GC problems with OCaml and C: OCaml 2.04 bug? To: David.Mentre@irisa.fr (David=?iso-8859-1?q?_Mentr=E9?=) Date: Mon, 21 Feb 2000 21:10:34 +0100 (MET) Cc: caml-list@inria.fr (OCAML) In-Reply-To: from "David=?iso-8859-1?q?_Mentr=E9?=" at Feb 21, 2000 03:09:30 PM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: weis > 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