English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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-11 (14:11)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: [Caml-list] Heaps size problems with "caml_alloc_small" in foreign function interfaces
> 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