/[pcre]/code/trunk/doc/html/pcreperform.html
ViewVC logotype

Diff of /code/trunk/doc/html/pcreperform.html

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 868 by ph10, Thu Jun 3 19:18:24 2010 UTC revision 869 by ph10, Sat Jan 14 11:16:23 2012 UTC
# Line 24  of them. Line 24  of them.
24  COMPILED PATTERN MEMORY USAGE  COMPILED PATTERN MEMORY USAGE
25  </b><br>  </b><br>
26  <P>  <P>
27  Patterns are compiled by PCRE into a reasonably efficient byte code, so that  Patterns are compiled by PCRE into a reasonably efficient interpretive code, so
28  most simple patterns do not use much memory. However, there is one case where  that most simple patterns do not use much memory. However, there is one case
29  the memory usage of a compiled pattern can be unexpectedly large. If a  where the memory usage of a compiled pattern can be unexpectedly large. If a
30  parenthesized subpattern has a quantifier with a minimum greater than 1 and/or  parenthesized subpattern has a quantifier with a minimum greater than 1 and/or
31  a limited maximum, the whole subpattern is repeated in the compiled code. For  a limited maximum, the whole subpattern is repeated in the compiled code. For
32  example, the pattern  example, the pattern
# Line 48  example, the very simple pattern Line 48  example, the very simple pattern
48  <pre>  <pre>
49    ((ab){1,1000}c){1,3}    ((ab){1,1000}c){1,3}
50  </pre>  </pre>
51  uses 51K bytes when compiled. When PCRE is compiled with its default internal  uses 51K bytes when compiled using the 8-bit library. When PCRE is compiled
52  pointer size of two bytes, the size limit on a compiled pattern is 64K, and  with its default internal pointer size of two bytes, the size limit on a
53  this is reached with the above pattern if the outer repetition is increased  compiled pattern is 64K data units, and this is reached with the above pattern
54  from 3 to 4. PCRE can be compiled to use larger internal pointers and thus  if the outer repetition is increased from 3 to 4. PCRE can be compiled to use
55  handle larger compiled patterns, but it is better to try to rewrite your  larger internal pointers and thus handle larger compiled patterns, but it is
56  pattern to use less memory if you can.  better to try to rewrite your pattern to use less memory if you can.
57  </P>  </P>
58  <P>  <P>
59  One way of reducing the memory usage for such patterns is to make use of PCRE's  One way of reducing the memory usage for such patterns is to make use of PCRE's
# Line 77  that PCRE cannot otherwise handle. Line 77  that PCRE cannot otherwise handle.
77  STACK USAGE AT RUN TIME  STACK USAGE AT RUN TIME
78  </b><br>  </b><br>
79  <P>  <P>
80  When <b>pcre_exec()</b> is used for matching, certain kinds of pattern can cause  When <b>pcre_exec()</b> or <b>pcre16_exec()</b> is used for matching, certain
81  it to use large amounts of the process stack. In some environments the default  kinds of pattern can cause it to use large amounts of the process stack. In
82  process stack is quite small, and if it runs out the result is often SIGSEGV.  some environments the default process stack is quite small, and if it runs out
83  This issue is probably the most frequently raised problem with PCRE. Rewriting  the result is often SIGSEGV. This issue is probably the most frequently raised
84  your pattern can often help. The  problem with PCRE. Rewriting your pattern can often help. The
85  <a href="pcrestack.html"><b>pcrestack</b></a>  <a href="pcrestack.html"><b>pcrestack</b></a>
86  documentation discusses this issue in detail.  documentation discusses this issue in detail.
87  </P>  </P>
# Line 110  character classes such as [:alpha:] do n Line 110  character classes such as [:alpha:] do n
110  backwards compatibility, and partly for performance reasons. However, you can  backwards compatibility, and partly for performance reasons. However, you can
111  set PCRE_UCP if you want Unicode character properties to be used. This can  set PCRE_UCP if you want Unicode character properties to be used. This can
112  double the matching time for items such as \d, when matched with  double the matching time for items such as \d, when matched with
113  <b>pcre_exec()</b>; the performance loss is less with <b>pcre_dfa_exec()</b>, and  a traditional matching function; the performance loss is less with
114  in both cases there is not much difference for \b.  a DFA matching function, and in both cases there is not much difference for
115    \b.
116  </P>  </P>
117  <P>  <P>
118  When a pattern begins with .* not in parentheses, or in parentheses that are  When a pattern begins with .* not in parentheses, or in parentheses that are
# Line 186  Cambridge CB2 3QH, England. Line 187  Cambridge CB2 3QH, England.
187  REVISION  REVISION
188  </b><br>  </b><br>
189  <P>  <P>
190  Last updated: 16 May 2010  Last updated: 09 January 2012
191  <br>  <br>
192  Copyright &copy; 1997-2010 University of Cambridge.  Copyright &copy; 1997-2012 University of Cambridge.
193  <br>  <br>
194  <p>  <p>
195  Return to the <a href="index.html">PCRE index page</a>.  Return to the <a href="index.html">PCRE index page</a>.

Legend:
Removed from v.868  
changed lines
  Added in v.869

  ViewVC Help
Powered by ViewVC 1.1.5