From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id DC4BDBC88 for ; Thu, 3 Feb 2005 12:23:13 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j13BND5A022672 for ; Thu, 3 Feb 2005 12:23:13 +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 MAA00785 for ; Thu, 3 Feb 2005 12:23:12 +0100 (MET) Received: from cradle.home.net (chowdhury95.demon.co.uk [80.177.9.225]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j13BNCEu022668 for ; Thu, 3 Feb 2005 12:23:12 +0100 Received: from ucacruc by cradle.home.net with local (Exim 4.34) id 1CwfDH-0000Uk-Q3; Thu, 03 Feb 2005 11:31:55 +0000 Date: Thu, 3 Feb 2005 11:31:55 +0000 From: ronniec95@lineone.net To: Olivier Andrieu Cc: caml-list@inria.fr Subject: Re: [Caml-list] GC with C issues Message-ID: <20050203113155.GA1860@cradle> References: <20050203105826.GA1669@cradle> <20050203.121643.41633039.andrieu@ijm.jussieu.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050203.121643.41633039.andrieu@ijm.jussieu.fr> User-Agent: Mutt/1.4.2i Sender: X-Miltered: at nez-perce with ID 420209A1.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 420209A0.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; lineone:01 caml-list:01 andrieu:01 wrote:01 segfault:01 camlparam:01 camlreturn:01 camlreturn:01 alloc:01 alloc:01 freeing:98 retval:98 ...:98 ...:98 abstract:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.7 required=5.0 tests=FORGED_RCVD_HELO, FROM_ENDS_IN_NUMS,NO_REAL_NAME autolearn=disabled version=3.0.2 X-Spam-Level: On Thu, Feb 03, 2005 at 12:16:43PM +0100, Olivier Andrieu wrote: > > 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; Hmm... I thought I was only supposed to do that when using alloc_small/alloc_shr interface? However using your method does work in this small example though I'm worried about if something unexpected will happen in more 'real-life' code... Regards Ronnie > > > -- > Olivier