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 concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 154DBBC6B for ; Wed, 13 Jun 2007 18:20:10 +0200 (CEST) Received: from smtp6-g19.free.fr (smtp6-g19.free.fr [212.27.42.36]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l5DGK94g018453 for ; Wed, 13 Jun 2007 18:20:09 +0200 Received: from [192.168.1.2] (che78-2-82-237-71-191.fbx.proxad.net [82.237.71.191]) by smtp6-g19.free.fr (Postfix) with ESMTP id E7185B5F91 for ; Wed, 13 Jun 2007 18:20:08 +0200 (CEST) Message-ID: <46701938.4040804@inria.fr> Date: Wed, 13 Jun 2007 18:20:08 +0200 From: Xavier Leroy User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] cywgin stack overflow References: <1181720072.23474.13.camel@rosella.wigram> <1181738340.6135.6.camel@rosella.wigram> <1181743209.6135.13.camel@rosella.wigram> <1181744198.6141.3.camel@rosella.wigram> In-Reply-To: X-Enigmail-Version: 0.91.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 46701939.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; stack:01 ocaml:01 stack:01 ocamlopt:01 gcc:01 bytecode:01 ocamlc:01 ocamlc:01 ocamlopt:01 bytecode:01 malloc:01 'l':01 native-code:01 compiler:01 run-time:01 > Ouch. Is there a place I can find information on how stacks are > implemented in Ocaml without having to wade through source? > Particularly, I imagine the options to increase stack size of the > executable compiled with ocamlopt would not be the same as for gcc... Actually, they are the same. Let me try to clarify: For bytecode executables produced by ocamlc or ocamlc.opt (this includes ocamlc, ocamlopt, etc): the executables do not not contain any limit on the stack size. The bytecode interpreter will resize its stack (allocated with malloc()) as needed, up to a limit that can be set using the 'l' parameter in the OCAMLRUNPARAM environment variable. For native-code executables produced by ocamlopt or ocamlopt.opt (this includes ocamlc.opt, ocamlopt.opt, etc): these are produced by calling the C compiler with a bunch of .o and .a files, some generated from Caml via the assembler, others (the run-time system) being compiled from C. So, if your C compiler has flags to set a stack limit in the generated executable, just give these flags to ocamlopt in a -ccopt option. (See Matthieu Wipliez's reply on this list.) Actually, it might be sufficient to build the Cygwin OCaml package by configuring with ./configure -cc "gcc -Wl,--stack -Wl,10485760" so that these options will be added automatically, both when building ocamlrun and when ocamlopt calls gcc to produce native executables. Hope this helps, - Xavier Leroy