Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Heaps size problems with "caml_alloc_small" in foreign function interfaces
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-07-12 (03:22)
From: Sean Seefried <sean.seefried@n...>
Subject: Re: [Caml-list] Heaps size problems with "caml_alloc_small" in foreign function interfaces
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?


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