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=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 63025BBAF for ; Fri, 11 Jul 2008 16:11:47 +0200 (CEST) X-IronPort-AV: E=Sophos;i="4.30,345,1212357600"; d="scan'208";a="15031063" Received: from estephe.inria.fr (HELO [128.93.11.95]) ([128.93.11.95]) by mail3-relais-sop.national.inria.fr with ESMTP; 11 Jul 2008 16:11:47 +0200 Message-ID: <48776A23.2010600@inria.fr> Date: Fri, 11 Jul 2008 16:11:47 +0200 From: Xavier Leroy User-Agent: Thunderbird 1.5.0.7 (X11/20060915) MIME-Version: 1.0 To: Sean Seefried Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Heaps size problems with "caml_alloc_small" in foreign function interfaces References: In-Reply-To: X-Enigmail-Version: 0.94.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; alloc:01 alloc:01 bug:01 repro:98 stack:01 heap:01 heap:01 caml-list:01 interfaces:01 caml:02 caml:02 seems:03 segmentation:03 root:04 fault:04 > 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