summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Jerram <neil@ossau.uklinux.net>2002-07-16 22:25:49 +0000
committerNeil Jerram <neil@ossau.uklinux.net>2002-07-16 22:25:49 +0000
commit3db03338199f4337178d6a07795f1c37b0c5107b (patch)
tree1cc115e03d47c17a8c01a2d288fb430be2b2d84f
parentc5d130619390fc3fd815011e69abe32fa8e13092 (diff)
downloadguile-3db03338199f4337178d6a07795f1c37b0c5107b.tar.gz
New doc about stack overflow.
-rw-r--r--doc/ref/ChangeLog5
-rw-r--r--doc/ref/scheme-options.texi34
2 files changed, 39 insertions, 0 deletions
diff --git a/doc/ref/ChangeLog b/doc/ref/ChangeLog
index 01d698795..8b8ff5a6b 100644
--- a/doc/ref/ChangeLog
+++ b/doc/ref/ChangeLog
@@ -1,3 +1,8 @@
+2002-07-16 Neil Jerram <neil@ossau.uklinux.net>
+
+ * scheme-options.texi (Debugger options): New subsection
+ describing stack overflow and what to do about it.
+
2002-07-10 Gary Houston <ghouston@arglist.com>
* scheme-modules.texi (Compiled Code Modules): Removed description
diff --git a/doc/ref/scheme-options.texi b/doc/ref/scheme-options.texi
index e67429a64..63b7a2c57 100644
--- a/doc/ref/scheme-options.texi
+++ b/doc/ref/scheme-options.texi
@@ -251,6 +251,40 @@ breakpoints no *Check for breakpoints.
cheap yes *Flyweight representation of the stack at traps.
@end smallexample
+@subsection Stack overflow
+
+@cindex overflow, stack
+@cindex stack overflow
+Stack overflow errors are caused by a computation trying to use more
+stack space than has been enabled by the @code{stack} option. They are
+reported like this:
+
+@lisp
+(non-tail-recursive-factorial 500)
+@print{}
+ERROR: Stack overflow
+ABORT: (stack-overflow)
+@end lisp
+
+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 @code{debug-set!}, for example:
+
+@lisp
+(debug-set! stack 200000)
+@result{}
+(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)
+@result{}
+122013682599111006870123878542304692625357434@dots{}
+@end lisp
+
+If you prefer to try rewriting your code, you may be able to save stack
+space by making some of your procedures @dfn{tail recursive}. For a
+description of what this means, see @ref{Proper tail
+recursion,,,r5rs,The Revised^5 Report on Scheme}.
+
@node Examples of option use
@section Examples of option use