Lähettäjä: Graycode Päiväys: Vastaanottaja: pcre-dev Aihe: Re: [pcre-dev] [PATCH] Quash deprecation warnings on Windows
On Wed, 12 Dec 2012, Daniel Richard G. wrote:
> I linked it with /STACK:10000000; should that be enough?
Whether it's enough depends on many factors. As Philip recently
reminded me, the "pcrestack man page" states:
The actual amount of stack used per recursion can vary quite a lot,
depending on the compiler that was used to build PCRE and the
optimization or debugging options that were set for it.
An approximation of the number of bytes needed by PCRE for each stack
recursion can be shown by:
pcretest -m -C
For the config options that I often use to build the PCRE library for
32-bit Windows compiled with optimization for speed (-O2), it says:
Match recursion uses stack: approximate frame size = 368 bytes
Last I checked (by trial and error) passing Test #2 expressions needed
roughly 6,200 recursive stack depth to succeed. Doing the math, I'd
have to link pcretest with about 2.3 Meg of stack for it to finish.
If I compile the library without optimization (-Od), then it shows:
Match recursion uses stack: approximate frame size = 992 bytes
For that to pass Test #2, pcretest would need about 6.2 Meg of stack.
Maybe the approximation by "pcretest -m -C" will provide a clue about
the stack requirement that your particular compile process generates.
Since you're building for 64-bit and probably using different PCRE
config options, I'd expect your stack requirement to be higher than
mine.
In situations where the possibility of a stack fault is not acceptable
then the NO_RECURSE config option is terrific.