| 1 |
'\" |
| 2 |
'\" Copyright (c) 1989-1993 The Regents of the University of California. |
| 3 |
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc. |
| 4 |
'\" |
| 5 |
'\" See the file "license.terms" for information on usage and redistribution |
| 6 |
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 7 |
'\" |
| 8 |
.TH Tcl_SetRecursionLimit 3 7.0 Tcl "Tcl Library Procedures" |
| 9 |
.so man.macros |
| 10 |
.BS |
| 11 |
.SH NAME |
| 12 |
Tcl_SetRecursionLimit \- set maximum allowable nesting depth in interpreter |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
\fB#include <tcl.h>\fR |
| 16 |
.sp |
| 17 |
int |
| 18 |
\fBTcl_SetRecursionLimit\fR(\fIinterp, depth\fR) |
| 19 |
.SH ARGUMENTS |
| 20 |
.AS Tcl_Interp *interp |
| 21 |
.AP Tcl_Interp *interp in |
| 22 |
Interpreter whose recursion limit is to be set. |
| 23 |
Must be greater than zero. |
| 24 |
.AP int depth in |
| 25 |
New limit for nested calls to \fBTcl_Eval\fR for \fIinterp\fR. |
| 26 |
.BE |
| 27 |
|
| 28 |
.SH DESCRIPTION |
| 29 |
.PP |
| 30 |
At any given time Tcl enforces a limit on the number of recursive |
| 31 |
calls that may be active for \fBTcl_Eval\fR and related procedures |
| 32 |
such as \fBTcl_GlobalEval\fR. |
| 33 |
Any call to \fBTcl_Eval\fR that exceeds this depth is aborted with |
| 34 |
an error. |
| 35 |
By default the recursion limit is 1000. |
| 36 |
.PP |
| 37 |
\fBTcl_SetRecursionLimit\fR may be used to change the maximum |
| 38 |
allowable nesting depth for an interpreter. |
| 39 |
The \fIdepth\fR argument specifies a new limit for \fIinterp\fR, |
| 40 |
and \fBTcl_SetRecursionLimit\fR returns the old limit. |
| 41 |
To read out the old limit without modifying it, invoke |
| 42 |
\fBTcl_SetRecursionLimit\fR with \fIdepth\fR equal to 0. |
| 43 |
.PP |
| 44 |
The \fBTcl_SetRecursionLimit\fR only sets the size of the Tcl |
| 45 |
call stack: it cannot by itself prevent stack overflows on the |
| 46 |
C stack being used by the application. If your machine has a |
| 47 |
limit on the size of the C stack, you may get stack overflows |
| 48 |
before reaching the limit set by \fBTcl_SetRecursionLimit\fR. |
| 49 |
If this happens, see if there is a mechanism in your system for |
| 50 |
increasing the maximum size of the C stack. |
| 51 |
|
| 52 |
.SH KEYWORDS |
| 53 |
nesting depth, recursion |