--- code/trunk/doc/pcre.txt 2009/10/19 14:38:48 469 +++ code/trunk/doc/pcre.txt 2010/01/06 10:26:55 487 @@ -6958,87 +6958,100 @@ restarted instead. The pcre_dfa_exec() function operates in an entirely different way, and - hardly uses recursion at all. The limit on its complexity is the amount - of workspace it is given. The comments that follow do NOT apply to - pcre_dfa_exec(); they are relevant only for pcre_exec(). - - You can set limits on the number of times that match() is called, both - in total and recursively. If the limit is exceeded, an error occurs. - For details, see the section on extra data for pcre_exec() in the - pcreapi documentation. - - Each time that match() is actually called recursively, it uses memory - from the process stack. For certain kinds of pattern and data, very - large amounts of stack may be needed, despite the recognition of "tail - recursion". You can often reduce the amount of recursion, and there- - fore the amount of stack used, by modifying the pattern that is being + uses recursion only when there is a regular expression recursion or + subroutine call in the pattern. This includes the processing of asser- + tion and "once-only" subpatterns, which are handled like subroutine + calls. Normally, these are never very deep, and the limit on the com- + plexity of pcre_dfa_exec() is controlled by the amount of workspace it + is given. However, it is possible to write patterns with runaway infi- + nite recursions; such patterns will cause pcre_dfa_exec() to run out of + stack. At present, there is no protection against this. + + The comments that follow do NOT apply to pcre_dfa_exec(); they are rel- + evant only for pcre_exec(). + + Reducing pcre_exec()'s stack usage + + Each time that match() is actually called recursively, it uses memory + from the process stack. For certain kinds of pattern and data, very + large amounts of stack may be needed, despite the recognition of "tail + recursion". You can often reduce the amount of recursion, and there- + fore the amount of stack used, by modifying the pattern that is being matched. Consider, for example, this pattern: ([^<]|<(?!inet))+ - It matches from wherever it starts until it encounters "