From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA15319; Mon, 27 Aug 2001 17:25:17 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA15306 for ; Mon, 27 Aug 2001 17:25:16 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f7RFPEP04752; Mon, 27 Aug 2001 17:25:14 +0200 (MET DST) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA15106; Mon, 27 Aug 2001 17:25:14 +0200 (MET DST) Date: Mon, 27 Aug 2001 17:25:14 +0200 From: Xavier Leroy To: Al Christians Cc: caml-list@inria.fr Subject: Re: [Caml-list] Queens examples Message-ID: <20010827172514.C13457@pauillac.inria.fr> References: <3B88A467.D16DD57D@easystreet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <3B88A467.D16DD57D@easystreet.com>; from achrist@easystreet.com on Sun, Aug 26, 2001 at 12:25:27AM -0700 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > Running the queens and queens_lazy basic examples in OCamlWin gives > a stack overflow with board size of 12 x 12. The queens_lazy > example is set-up to do 12 x 12, so it crashes right out of the box. > Does OCaml often produce such errors? Is there a trick to preventing > these errors that was overlooked in writing these examples? Just to complement the detailed replies already made on this list: OCaml would happily grow the stack until all the available memory (physical and virtual) is exhausted. However, excessive stack consumption is often the sign of a programming error (recursion that misses the base case), and exhausting all the memory before reporting it is not nice, so OCaml implements a soft limit on the size of the stack. By default, it's 1 megabyte, but it can be changed from the command line (the CAMLRUNPARAM variable) or even from within the program or the interactive system: Gc.set {(Gc.get()) with Gc.stack_limit = 4 * 1024 * 1024} The above bumps the limit to 4 mega-words (16 mega-bytes), and is enough to run the Queens example with size 12. Hope this helps, - Xavier Leroy ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr