| 113 |
<br><a name="SEC7" href="#TOC1">LIMITING PCRE RESOURCE USAGE</a><br> |
<br><a name="SEC7" href="#TOC1">LIMITING PCRE RESOURCE USAGE</a><br> |
| 114 |
<P> |
<P> |
| 115 |
Internally, PCRE has a function called <b>match()</b>, which it calls repeatedly |
Internally, PCRE has a function called <b>match()</b>, which it calls repeatedly |
| 116 |
(possibly recursively) when matching a pattern. By controlling the maximum |
(possibly recursively) when matching a pattern with the <b>pcre_exec()</b> |
| 117 |
number of times this function may be called during a single matching operation, |
function. By controlling the maximum number of times this function may be |
| 118 |
a limit can be placed on the resources used by a single call to |
called during a single matching operation, a limit can be placed on the |
| 119 |
<b>pcre_exec()</b>. The limit can be changed at run time, as described in the |
resources used by a single call to <b>pcre_exec()</b>. The limit can be changed |
| 120 |
|
at run time, as described in the |
| 121 |
<a href="pcreapi.html"><b>pcreapi</b></a> |
<a href="pcreapi.html"><b>pcreapi</b></a> |
| 122 |
documentation. The default is 10 million, but this can be changed by adding a |
documentation. The default is 10 million, but this can be changed by adding a |
| 123 |
setting such as |
setting such as |
| 124 |
<pre> |
<pre> |
| 125 |
--with-match-limit=500000 |
--with-match-limit=500000 |
| 126 |
</pre> |
</pre> |
| 127 |
to the <b>configure</b> command. |
to the <b>configure</b> command. This setting has no effect on the |
| 128 |
|
<b>pcre_dfa_exec()</b> matching function. |
| 129 |
</P> |
</P> |
| 130 |
<br><a name="SEC8" href="#TOC1">HANDLING VERY LARGE PATTERNS</a><br> |
<br><a name="SEC8" href="#TOC1">HANDLING VERY LARGE PATTERNS</a><br> |
| 131 |
<P> |
<P> |
| 150 |
</P> |
</P> |
| 151 |
<br><a name="SEC9" href="#TOC1">AVOIDING EXCESSIVE STACK USAGE</a><br> |
<br><a name="SEC9" href="#TOC1">AVOIDING EXCESSIVE STACK USAGE</a><br> |
| 152 |
<P> |
<P> |
| 153 |
PCRE implements backtracking while matching by making recursive calls to an |
When matching with the <b>pcre_exec()</b> function, PCRE implements backtracking |
| 154 |
internal function called <b>match()</b>. In environments where the size of the |
by making recursive calls to an internal function called <b>match()</b>. In |
| 155 |
stack is limited, this can severely limit PCRE's operation. (The Unix |
environments where the size of the stack is limited, this can severely limit |
| 156 |
environment does not usually suffer from this problem.) An alternative approach |
PCRE's operation. (The Unix environment does not usually suffer from this |
| 157 |
that uses memory from the heap to remember data, instead of using recursive |
problem.) An alternative approach that uses memory from the heap to remember |
| 158 |
function calls, has been implemented to work round this problem. If you want to |
data, instead of using recursive function calls, has been implemented to work |
| 159 |
build a version of PCRE that works this way, add |
round this problem. If you want to build a version of PCRE that works this way, |
| 160 |
|
add |
| 161 |
<pre> |
<pre> |
| 162 |
--disable-stack-for-recursion |
--disable-stack-for-recursion |
| 163 |
</pre> |
</pre> |
| 168 |
always freed in reverse order. A calling program might be able to implement |
always freed in reverse order. A calling program might be able to implement |
| 169 |
optimized functions that perform better than the standard <b>malloc()</b> and |
optimized functions that perform better than the standard <b>malloc()</b> and |
| 170 |
<b>free()</b> functions. PCRE runs noticeably more slowly when built in this |
<b>free()</b> functions. PCRE runs noticeably more slowly when built in this |
| 171 |
way. |
way. This option affects only the <b>pcre_exec()</b> function; it is not |
| 172 |
|
relevant for the the <b>pcre_dfa_exec()</b> function. |
| 173 |
</P> |
</P> |
| 174 |
<br><a name="SEC10" href="#TOC1">USING EBCDIC CODE</a><br> |
<br><a name="SEC10" href="#TOC1">USING EBCDIC CODE</a><br> |
| 175 |
<P> |
<P> |
| 182 |
to the <b>configure</b> command. |
to the <b>configure</b> command. |
| 183 |
</P> |
</P> |
| 184 |
<P> |
<P> |
| 185 |
Last updated: 09 September 2004 |
Last updated: 28 February 2005 |
| 186 |
<br> |
<br> |
| 187 |
Copyright © 1997-2004 University of Cambridge. |
Copyright © 1997-2005 University of Cambridge. |
| 188 |
<p> |
<p> |
| 189 |
Return to the <a href="index.html">PCRE index page</a>. |
Return to the <a href="index.html">PCRE index page</a>. |
| 190 |
</p> |
</p> |