Forum: CFEngine Help
Subject: Re: memory exhausted error
Author: mvpel
Link to topic: https://cfengine.com/forum/read.php?3,26349,26426#msg-26426

This may be what's happening here:

http://www.gnu.org/software/bison/manual/html_node/Memory-Management.html

The Bison parser stack can run out of memory if too many tokens are shifted and 
not reduced. When this happens, the parser function yyparse calls yyerror and 
then returns 2.

Because Bison parsers have growing stacks, hitting the upper limit usually 
results from using a right recursion instead of a left recursion, See Recursive 
Rules.

By defining the macro YYMAXDEPTH, you can control how deep the parser stack can 
become before memory is exhausted. Define the macro with a value that is an 
integer. This value is the maximum number of tokens that can be shifted (and 
not reduced) before overflow.

The stack space allowed is not necessarily allocated. If you specify a large 
value for YYMAXDEPTH, the parser normally allocates a small stack at first, and 
then makes it bigger by stages as needed. This increasing allocation happens 
automatically and silently. Therefore, you do not need to make YYMAXDEPTH 
painfully small merely to save space for ordinary inputs that do not need much 
stack.

However, do not allow YYMAXDEPTH to be a value so large that arithmetic 
overflow could occur when calculating the size of the stack space. Also, do not 
allow YYMAXDEPTH to be less than YYINITDEPTH.

The default value of YYMAXDEPTH, if you do not define it, is 10000.

You can control how much stack is allocated initially by defining the macro 
YYINITDEPTH to a positive integer. For the deterministic parser in C, this 
value must be a compile-time constant unless you are assuming C99 or some other 
target language or compiler that allows variable-length arrays. The default is 
200.

Do not allow YYINITDEPTH to be greater than YYMAXDEPTH.

Because of semantic differences between C and C++, the deterministic parsers in 
C produced by Bison cannot grow when compiled by C++ compilers. In this precise 
case (compiling a C parser as C++) you are suggested to grow YYINITDEPTH. The 
Bison maintainers hope to fix this deficiency in a future release.

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to