52 |
required. Consider now this rewritten pattern, which matches exactly the same |
required. Consider now this rewritten pattern, which matches exactly the same |
53 |
strings: |
strings: |
54 |
.sp |
.sp |
55 |
([^<]++|<(?!inet)) |
([^<]++|<(?!inet))+ |
56 |
.sp |
.sp |
57 |
This uses very much less stack, because runs of characters that do not contain |
This uses very much less stack, because runs of characters that do not contain |
58 |
"<" are "swallowed" in one item inside the parentheses. Recursion happens only |
"<" are "swallowed" in one item inside the parentheses. Recursion happens only |
72 |
.\" HREF |
.\" HREF |
73 |
\fBpcrebuild\fP |
\fBpcrebuild\fP |
74 |
.\" |
.\" |
75 |
documentation. |
documentation. When built in this way, instead of using the stack, PCRE obtains |
76 |
|
and frees memory by calling the functions that are pointed to by the |
77 |
|
\fBpcre_stack_malloc\fP and \fBpcre_stack_free\fP variables. By default, these |
78 |
|
point to \fBmalloc()\fP and \fBfree()\fP, but you can replace the pointers to |
79 |
|
cause PCRE to use your own functions. Since the block sizes are always the |
80 |
|
same, and are always freed in reverse order, it may be possible to implement |
81 |
|
customized memory handlers that are more efficient than the standard functions. |
82 |
.P |
.P |
83 |
In Unix-like environments, there is not often a problem with the stack unless |
In Unix-like environments, there is not often a problem with the stack unless |
84 |
very long strings are involved, though the default limit on stack size varies |
very long strings are involved, though the default limit on stack size varies |
119 |
should set the limit at 16000 recursions. A 64Mb stack, on the other hand, can |
should set the limit at 16000 recursions. A 64Mb stack, on the other hand, can |
120 |
support around 128000 recursions. The \fBpcretest\fP test program has a command |
support around 128000 recursions. The \fBpcretest\fP test program has a command |
121 |
line option (\fB-S\fP) that can be used to increase the size of its stack. |
line option (\fB-S\fP) that can be used to increase the size of its stack. |
122 |
.P |
. |
123 |
.in 0 |
. |
124 |
Last updated: 14 September 2006 |
.SH AUTHOR |
125 |
.br |
.rs |
126 |
Copyright (c) 1997-2006 University of Cambridge. |
.sp |
127 |
|
.nf |
128 |
|
Philip Hazel |
129 |
|
University Computing Service |
130 |
|
Cambridge CB2 3QH, England. |
131 |
|
.fi |
132 |
|
. |
133 |
|
. |
134 |
|
.SH REVISION |
135 |
|
.rs |
136 |
|
.sp |
137 |
|
.nf |
138 |
|
Last updated: 05 June 2007 |
139 |
|
Copyright (c) 1997-2007 University of Cambridge. |
140 |
|
.fi |