caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: Al Christians <achrist@easystreet.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Queens examples
Date: Mon, 27 Aug 2001 17:25:14 +0200	[thread overview]
Message-ID: <20010827172514.C13457@pauillac.inria.fr> (raw)
In-Reply-To: <3B88A467.D16DD57D@easystreet.com>; from achrist@easystreet.com on Sun, Aug 26, 2001 at 12:25:27AM -0700

> 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


      parent reply	other threads:[~2001-08-27 15:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-26  7:25 Al Christians
2001-08-26 11:33 ` Gerd Stolpmann
2001-08-26 13:57   ` Laurent Chéno
2001-08-27 10:53   ` Frank Atanassow
2001-08-27 15:25 ` Xavier Leroy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010827172514.C13457@pauillac.inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=achrist@easystreet.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).