--- embedaddon/pcre/doc/html/pcrestack.html 2012/02/21 23:50:25 1.1.1.2 +++ embedaddon/pcre/doc/html/pcrestack.html 2013/07/22 08:25:57 1.1.1.3 @@ -16,7 +16,7 @@ man page, in case the conversion went wrong. PCRE DISCUSSION OF STACK USAGE

-When you call pcre[16]_exec(), it makes use of an internal function +When you call pcre[16|32]_exec(), it makes use of an internal function called match(). This calls itself recursively at branch points in the pattern, in order to remember the state of the match so that it can back up and try a different alternative if the first one fails. As matching proceeds deeper @@ -33,32 +33,32 @@ the recursive call would immediately be passed back as current call (a "tail recursion"), the function is just restarted instead.

-The above comments apply when pcre[16]_exec() is run in its normal +The above comments apply when pcre[16|32]_exec() is run in its normal interpretive manner. If the pattern was studied with the PCRE_STUDY_JIT_COMPILE option, and just-in-time compiling was successful, and -the options passed to pcre[16]_exec() were not incompatible, the matching +the options passed to pcre[16|32]_exec() were not incompatible, the matching process uses the JIT-compiled code instead of the match() function. In this case, the memory requirements are handled entirely differently. See the pcrejit documentation for details.

-The pcre[16]_dfa_exec() function operates in an entirely different way, +The pcre[16|32]_dfa_exec() function operates in an entirely different way, and uses recursion only when there is a regular expression recursion or subroutine call in the pattern. This includes the processing of assertion and "once-only" subpatterns, which are handled like subroutine calls. Normally, these are never very deep, and the limit on the complexity of -pcre[16]_dfa_exec() is controlled by the amount of workspace it is given. +pcre[16|32]_dfa_exec() is controlled by the amount of workspace it is given. However, it is possible to write patterns with runaway infinite recursions; -such patterns will cause pcre[16]_dfa_exec() to run out of stack. At +such patterns will cause pcre[16|32]_dfa_exec() to run out of stack. At present, there is no protection against this.

-The comments that follow do NOT apply to pcre[16]_dfa_exec(); they are -relevant only for pcre[16]_exec() without the JIT optimization. +The comments that follow do NOT apply to pcre[16|32]_dfa_exec(); they are +relevant only for pcre[16|32]_exec() without the JIT optimization.


-Reducing pcre[16]_exec()'s stack usage +Reducing pcre[16|32]_exec()'s stack usage

Each time that match() is actually called recursively, it uses memory @@ -94,17 +94,17 @@ subject strings is to write repeated parenthesized sub than one character whenever possible.


-Compiling PCRE to use heap instead of stack for pcre[16]_exec() +Compiling PCRE to use heap instead of stack for pcre[16|32]_exec()

In environments where stack memory is constrained, you might want to compile PCRE to use heap memory instead of stack for remembering back-up points when -pcre[16]_exec() is running. This makes it run a lot more slowly, however. +pcre[16|32]_exec() is running. This makes it run a lot more slowly, however. Details of how to do this are given in the pcrebuild documentation. When built in this way, instead of using the stack, PCRE obtains and frees memory by calling the functions that are pointed to by the -pcre[16]_stack_malloc and pcre[16]_stack_free variables. By +pcre[16|32]_stack_malloc and pcre[16|32]_stack_free variables. By default, these point to malloc() and free(), but you can replace the pointers to cause PCRE to use your own functions. Since the block sizes are always the same, and are always freed in reverse order, it may be possible to @@ -112,18 +112,18 @@ implement customized memory handlers that are more eff functions.


-Limiting pcre[16]_exec()'s stack usage +Limiting pcre[16|32]_exec()'s stack usage

You can set limits on the number of times that match() is called, both in -total and recursively. If a limit is exceeded, pcre[16]_exec() returns an +total and recursively. If a limit is exceeded, pcre[16|32]_exec() returns an error code. Setting suitable limits should prevent it from running out of stack. The default values of the limits are very large, and unlikely ever to operate. They can be changed when PCRE is built, and they can also be set when -pcre[16]_exec() is called. For details of these interfaces, see the +pcre[16|32]_exec() is called. For details of these interfaces, see the pcrebuild documentation and the -section on extra data for pcre[16]_exec() +section on extra data for pcre[16|32]_exec() in the pcreapi documentation. @@ -139,7 +139,7 @@ In Unix-like environments, the pcretest test pr option (-S) that can be used to increase the size of its stack. As long as the stack is large enough, another option (-M) can be used to find the smallest limits that allow a particular pattern to match a given subject -string. This is done by calling pcre[16]_exec() repeatedly with different +string. This is done by calling pcre[16|32]_exec() repeatedly with different limits.


@@ -190,7 +190,7 @@ limit on stack size by code such as this: This reads the current limits (soft and hard) using getrlimit(), then attempts to increase the soft limit to 100Mb using setrlimit(). You must -do this before calling pcre[16]_exec(). +do this before calling pcre[16|32]_exec().


Changing stack size in Mac OS X @@ -216,7 +216,7 @@ Cambridge CB2 3QH, England. REVISION

-Last updated: 21 January 2012 +Last updated: 24 June 2012
Copyright © 1997-2012 University of Cambridge.