Perl-совместимые регулярные выражения (Perl-compatible regular expressions)
OBTAINING AN ESTIMATE OF STACK USAGE
Matching certain patterns using pcre_exec()
can use a lot of
process stack, which in certain environments can be rather
limited in size. Some users find it helpful to have an estimate
of the amount of stack that is used by pcre_exec()
, to help them
set recursion limits, as described in the pcrestack
documentation. The estimate that is output by pcretest
when
called with the -m
and -C
options is obtained by calling
pcre_exec
with the values NULL, NULL, NULL, -999, and -999 for
its first five arguments.
Normally, if its first argument is NULL, pcre_exec()
immediately
returns the negative error code PCRE_ERROR_NULL, but with this
special combination of arguments, it returns instead a negative
number whose absolute value is the approximate stack frame size
in bytes. (A negative number is used so that it is clear that no
match has happened.) The value is approximate because in some
cases, recursive calls to pcre_exec()
occur when there are one or
two additional variables on the stack.
If PCRE has been compiled to use the heap instead of the stack
for recursion, the value returned is the size of each block that
is obtained from the heap.