From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id CACB8BBAF for ; Sat, 12 Jul 2008 05:22:53 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ag4HAOvAd0jTHYS8Y2dsb2JhbACSIhoEHgOXGA X-IronPort-AV: E=Sophos;i="4.30,348,1212357600"; d="scan'208";a="15024903" Received: from mail07.syd.optusnet.com.au ([211.29.132.188]) by mail1-smtp-roc.national.inria.fr with ESMTP; 12 Jul 2008 05:22:51 +0200 Received: from [114.72.9.120] (114.72.9.120.optusnet.com.au [114.72.9.120] (may be forged)) by mail07.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id m6C3MkXi032631; Sat, 12 Jul 2008 13:22:47 +1000 References: <48776A23.2010600@inria.fr> Message-Id: <9CD17706-D992-4B85-998C-F47A1D8E3034@nicta.com.au> From: Sean Seefried To: Xavier Leroy In-Reply-To: <48776A23.2010600@inria.fr> Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (iPhone Mail 5A345) Subject: Re: [Caml-list] Heaps size problems with "caml_alloc_small" in foreign function interfaces Date: Sat, 12 Jul 2008 13:20:33 +1000 Cc: "caml-list@yquem.inria.fr" X-Mailer: iPhone Mail (5A345) X-Spam: no; 0.00; alloc:01 pointer:01 camlidl:01 alloc:01 bug:01 repro:98 wrote:01 stack:01 heap:01 heap:01 caml-list:01 interfaces:01 caml:02 caml:02 seems:03 Could you give me a pointer to information on root registration? What frustrates me is that this is CamlIDL generated code. Shouldn't it just work? Sean On 12/07/2008, at 0:11, Xavier Leroy wrote: >> I'm having a problem where sometimes a call to "caml_alloc_small" >> from C >> results in a segmentation fault. If I increase the size of the stack >> using OCAMLRUNPARAM=s=1000k then I don't get the crash anymore. It >> seems >> strange that I have to increase the size of the heap manually like >> this. > > It's probably a root registration problem. These are very sensitive > to the times when GC is triggered, which themselves are sensitive to > the heap sizes and memory behavior of your program. > >> If I want to increase the size of the heap in C how do I do this? >> Could >> I write a "safe" caml_alloc_small which first checks to see if >> there is >> enough memory and then increases the heap size if not? > > Don't try to hack around the real problem, but do make available a > repro case, no matter how large, on a Web site or as attachment to a > problem report on the bug tracking system, so that others can have a > look at it. > > - Xavier Leroy