StackOverflows {base} | R Documentation |
Errors signaled by R when stacks used in evaluation overflow.
R uses several stacks in evaluating expressions: the C stack, the
pointer protection stack, and the node stack used by the byte code
engine. In addition, the number of nested R expressions currently
under evaluation is limited by the value set as
options("expressions")
. Overflowing these stacks or
limits signals an error that inherits from classes
stackOverflowError
, error
, and condition
.
The specific classes signaled are:
CStackOverflowError
: Signaled when the C stack
overflows. The usage
field of the error object contains the
current stack usage.
protectStackOverflowError
: Signaled when the pointer
protection stack overflows.
nodeStackOverflowError
: Signaled when the node stack
used by the byte code engine overflows.
expressionStackOverflowError
: Signaled when the the
evaluation depth, the number of nested R expressions currently
under evaluation, exceeds the limit set by
options("expressions")
Stack overflow errors can be caught and handled by exiting handlers
established with tryCatch()
Calling handlers established
by withCallingHandlers()
may fail since there may not be
enough stack space to run the handler. In this case the next available
exiting handler will be run, or error handling will fall back to the
default handler. Default handlers set by
tryCatch("error")
may also fail to run in a stack
overflow situation.
Cstack_info
for information on the environment and the
evaluation depth limit.
Memory
and options
for information on the
protection stack.