Version française
Home     About     Download     Resources     Contact us    
Browse thread
ocamlc Stack_overflow
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Martin Jambon <martin1977@l...>
Subject: Re: [Caml-list] ocamlc Stack_overflow
On Tue, 8 Aug 2006, Denis Bueno wrote:

> [I tried sending this a few days ago with a rather large attachment.
> Since it hasn't been approved since then, I'm sending it again, sans
> attachment.]
>
> All--
>
> The source file available on my website [2] gives the following output
> (when uncompressed, of course):
>
> ,----
> | $ ocamlc -g -c spit_etest.ml
> | Fatal error: exception Stack_overflow
> `----
>
> I really have no idea where to start, whether it's my fault or
> ocamlc's. I have included some relevant system information [1].
>
> Could someone point my in the right direction?

You are using a huge list, and it is likely that the compiler uses some 
functions which will use stack space proportionally to the size of your list.
You can use one of the following options:
- use ocamlc.opt instead of ocamlc
- increase the maximum size of the stack:
     env OCAMLRUNPARAM=l=10M ocamlc -c spit_etest.ml
- store your data externally

Note that your program itself might have the same problem at runtime if 
you use non-tail-call optimized functions like List.map (see 
documentation for module List).


Martin

--
Martin Jambon, PhD
http://martin.jambon.free.fr