From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 91832BC88 for ; Thu, 3 Feb 2005 12:16:45 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j13BGjKa011764 for ; Thu, 3 Feb 2005 12:16:45 +0100 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 MAA00435 for ; Thu, 3 Feb 2005 12:16:44 +0100 (MET) Received: from shiva.jussieu.fr (shiva.jussieu.fr [134.157.0.129]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j13BGirn021759 for ; Thu, 3 Feb 2005 12:16:44 +0100 Received: from localhost (akasha.ijm.jussieu.fr [134.157.173.57]) by shiva.jussieu.fr (8.12.11/jtpda-5.4) with ESMTP id j13BGiZL075069 ; Thu, 3 Feb 2005 12:16:44 +0100 (CET) X-Ids: 168 Date: Thu, 03 Feb 2005 12:16:43 +0100 (CET) Message-Id: <20050203.121643.41633039.andrieu@ijm.jussieu.fr> To: ronniec95@lineone.net Cc: caml-list@inria.fr Subject: Re: [Caml-list] GC with C issues From: Olivier Andrieu In-Reply-To: <20050203105826.GA1669@cradle> References: <20050203105826.GA1669@cradle> X-Mailer: Mew version 4.1 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-1.7.2 (shiva.jussieu.fr [134.157.0.168]); Thu, 03 Feb 2005 12:16:44 +0100 (CET) X-Miltered: at concorde with ID 4202081D.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 4202081C.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at shiva.jussieu.fr with ID 4202081C.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Antivirus: scanned by sophie at shiva.jussieu.fr X-Spam: no; 0.00; caml-list:01 andrieu:01 andrieu:01 ijm:01 lineone:01 segfault:01 camlparam:01 camlreturn:01 camlreturn:01 ...:98 freeing:98 retval:98 abstract:01 short:01 short:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: ronniec95@lineone.net [Thu, 3 Feb 2005]: > > Hello all, > > I'm looking for some help with the following really short example > when I'm trying to reference a C allocated object from Caml (which > works fine), but the GC seems to not like it. Here's the sample > code - pretty short... > I can't see what I'm doing wrong in the allocation? I expect this > to leak because I'm not freeing the allocated 'someObject' but I > don't expect it to segfault though? When you use CAMLparam in a function you have to exit it with CAMLreturn (or CAMLreturn0). Do not use Store_field on your block: it's an Abstract block, not traced by the GC, use the Field macro directly : Field (retVal, 0) = (value) x; -- Olivier