mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-01 20:30:28 +02:00
New doc about stack overflow.
This commit is contained in:
parent
bd49c03c43
commit
9d3fa3f3cc
2 changed files with 39 additions and 0 deletions
|
@ -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-04-28 Marius Vollmer <mvo@zagadka.ping.de>
|
||||
|
||||
* gh.texi, data-rep.texi: Moved `@deftyp {Data type} SCM' line
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue