Re: [pcre-dev] Calculated match recursion stack size

Top Page
Delete this message
Author: Philip Hazel
Date:  
To: Graycode
CC: pcre-dev
Old-Topics: [pcre-dev] Calculated match recursion stack size
Subject: Re: [pcre-dev] Calculated match recursion stack size
On Tue, 6 Dec 2011, Graycode wrote:

> This is a feature request to enable PCRE to calculate and tell the net
> impact on the stack for each recursive call in the internal match()
> function used by pcre_exec().


I have just committed some experimental code. Are you in a position to
test it by checking out the trunk? A call to "pcretest -C" shows the
basic stack frame size used by pcre_exec() when --disable-stack-for-
recursion is not used (not including any extra ints); when --disable-
stack-for-recursion is used, it shows the size of the frame that is
malloc-ed from the heap.

On my 32-bit i86 system, with PCRE maximally configured (UTF + Unicode
property support) the size given is 626 bytes. I counted up the
variables, parameters, etc, and only got to about half this number,
but I don't know how gcc uses space on the stack. It almost looked as if
it was using 8 bytes per int. Hmm.

I have not documented any of this yet, other than a mention in
ChangeLog. I will only document it properly so if we decide it is worth
leaving the feature implemented.

Philip

--
Philip Hazel