Re: [pcre-dev] Recursion with possessive quantifiers

Pàgina inicial
Delete this message
Autor: ND
Data:  
A: pcre-dev
Assumpte: Re: [pcre-dev] Recursion with possessive quantifiers
On Thu, 19 May 2011 20:25:27 +0400, Philip Hazel <ph10@???>
wrote:

> I continue to be amazed, in this day of gigabyte main memories, that
> stack sizes are so restricted.


I'm too. But it's a Windows way and I can't change it.

> 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.


Using the heap slows pcre_exec() by about 3-5 times. It is not an eligible
choice.

Anyway is true that problem is actual in both cases (with stack or heap
usage):
The memory really needed to match an expression with possessive quantifier
is
less than eats pcre_exec() in reality.
Excessing memory amount is linearly proportional to number of
consequent repetitions of this expression in subject string.
There are subject strings when a repetitions number is huge.
This deep recursion not only increases memory usage but decreases a
potentional
matching speed too.


> When you process something like (?>(<EXPR>)*) ...


Is there a possibility to not convert expression with possessive
quantifiers to this form and write an effective handler?