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
Stack size on OS X
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-11-30 (16:07)
From: John Whitington <john@c...>
Subject: Re: [Caml-list] Stack size on OS X

On 30 Nov 2009, at 15:26, Christophe Raffalli wrote:
> It seems that the problem of stack size is still not solved in OS X (limited to 8Mo by default and
> hard limit in the kernel to 64Mo with ulimit -s 64000). My unison is still crashing on
> very big changes ...
> However, I stumbled on this pdf
> http://www.google.fr/url?sa=t&source=web&ct=res&cd=1&ved=0CAcQFjAA&url=http%3A%2F%2Fhomepage.mac.com%2Feric.c%2Fhpc%2Fcontents%2Fdocumentation%2FHow%2520to%2520increase%2520the%2520stack%2520size%2520on%2520Mac%2520OS%2520X.pdf&ei=v-MTS4aMG4Wj_AbFmok2&usg=AFQjCNH1qCjydtM1doAdtwtTJxaEAmwLSw&sig2=u9faAiBSuB7v-VzvHDPHRA)
> (This is the first hit on google with "increasing stack size on OS X")
> which explain how to use -stack-addr and -stack-size in the gnu linker to change the stack address
> and size.
> Did anyone try this on OS X for OCaml program ?
> I think stack limitation, for a functional program is not good and it is even worse when the limit
> depends upon the platform.

You may find that a small number of changes to the source code can prevent excess stack usage - it may not be riddled through the whole program. On an Intel macintosh, you can get the list of exceptions leading to the stack overflow from OCaml, and work through them to find the source of the problem.

On first compiling my codebase (about 100,000 lines) on a machine with limited stack size, it took only about a day to fix up.

I agree that, morally, stack space available and general memory available should be roughly equivalent concepts (like with Linux), but sometimes it's easier to give in - after all, how are you to estimate the size you actually need accurately?


John Whitington
Director, Coherent Graphics Ltd