Re: [pcre-dev] Recursion with possessive quantifiers

Pàgina inicial
Delete this message
Autor: Philip Hazel
Data:  
A: ND
CC: pcre-dev
Assumpte: Re: [pcre-dev] Recursion with possessive quantifiers
On Thu, 19 May 2011, ND wrote:

> May be it possible in this case to save every next back-up point over the
> previous (in the same memory block)?


I thought about this some more. When you process something like

(?>(<EXPR>)*)

the recursion happens while processing (<EXPR>)* and is necessary
because you might need to backtrack within the expression. In fact, all
the recursion ends when the end of the (?> parentheses is reached. The
contents of (?> parentheses, just like assertions, are processed just
like a single stand-alone pattern.

> I have a Windows and a restricted stack size. I have a 10-100 thousands
> repetitions, and the pcre_exec is excessively angry to memory.


I continue to be amazed, in this day of gigabyte main memories, that
stack sizes are so restricted. PCRE does support using the heap instead
of the stack if you compile with --disable-stack-for-recursion; this
feature was implemented specially for certain Windows users. However,
PCRE does run more slowly when it has, in effect, to manage its own
stack.

Philip

--
Philip Hazel