www.delorie.com/gnu/docs/guile/guile_386.html   search  
Buy GNU books!

Guile Reference Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ] 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)

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 section `Proper tail recursion' in The Revised^5 Report on Scheme.

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003