guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stack Size?


From: Neil Jerram
Subject: Re: Stack Size?
Date: 05 Aug 2002 19:55:01 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

>>>>> "address@hidden" == address@hidden net (Robert Uhl <<address@hidden>)> 
>>>>> writes:

    address@hidden> How deep can guile's stack be?

>From the HEAD CVS manual, in the index under `stack overflow':

Stack overflow
--------------

   Stack overflow errors are caused by a computation trying to use more
stack space than has been enabled by the `stack' option.  They are
reported like this:

     (non-tail-recursive-factorial 500)
     -|
     ERROR: Stack overflow
     ABORT: (stack-overflow)

   If you get an error like this, you can either try rewriting your
code to use less stack space, or increase the maximum stack size.  To
increase the maximum stack size, use `debug-set!', for example:

     (debug-set! stack 200000)
     =>
     (show-file-name #t stack 200000 debug backtrace depth 20 maxdepth 1000 
frames 3 indent 10 width 79 procnames cheap)
     
     (non-tail-recursive-factorial 500)
     =>
     122013682599111006870123878542304692625357434...

   If you prefer to try rewriting your code, you may be able to save
stack space by making some of your procedures "tail recursive".  For a
description of what this means, see *Note Proper tail recursion:
(r5rs)Proper tail recursion.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]