251 |
cheap yes *Flyweight representation of the stack at traps. |
cheap yes *Flyweight representation of the stack at traps. |
252 |
@end smallexample |
@end smallexample |
253 |
|
|
254 |
|
@subsection Stack overflow |
255 |
|
|
256 |
|
@cindex overflow, stack |
257 |
|
@cindex stack overflow |
258 |
|
Stack overflow errors are caused by a computation trying to use more |
259 |
|
stack space than has been enabled by the @code{stack} option. They are |
260 |
|
reported like this: |
261 |
|
|
262 |
|
@lisp |
263 |
|
(non-tail-recursive-factorial 500) |
264 |
|
@print{} |
265 |
|
ERROR: Stack overflow |
266 |
|
ABORT: (stack-overflow) |
267 |
|
@end lisp |
268 |
|
|
269 |
|
If you get an error like this, you can either try rewriting your code to |
270 |
|
use less stack space, or increase the maximum stack size. To increase |
271 |
|
the maximum stack size, use @code{debug-set!}, for example: |
272 |
|
|
273 |
|
@lisp |
274 |
|
(debug-set! stack 200000) |
275 |
|
@result{} |
276 |
|
(show-file-name #t stack 200000 debug backtrace depth 20 maxdepth 1000 frames 3 indent 10 width 79 procnames cheap) |
277 |
|
|
278 |
|
(non-tail-recursive-factorial 500) |
279 |
|
@result{} |
280 |
|
122013682599111006870123878542304692625357434@dots{} |
281 |
|
@end lisp |
282 |
|
|
283 |
|
If you prefer to try rewriting your code, you may be able to save stack |
284 |
|
space by making some of your procedures @dfn{tail recursive}. For a |
285 |
|
description of what this means, see @ref{Proper tail |
286 |
|
recursion,,,r5rs,The Revised^5 Report on Scheme}. |
287 |
|
|
288 |
|
|
289 |
@node Examples of option use |
@node Examples of option use |
290 |
@section Examples of option use |
@section Examples of option use |