[antlr-interest] C parser - tree generation - memory problem

Heinrich du Toit heinrich at silasvalley.com
Thu Sep 25 03:27:17 PDT 2008


Hi

MY code kept on giving segfaults..
So I traced it..

in antlr3commontree.c:
function newPool: ( around line 99)

basicly the ANTLR3_CALLOC there to create a new pool fails after a while..
Runs out of memory :(
But If you print out factory->thisPool then it runs very high.. high 
enough to flood a GB or 2..



anyways this causes segfault in newPoolTree.

segfault happens usually on this line:
    tree->baseTree.super    = tree;


Not sure how to fix but I'm suprised the thing runs out of memory :(
I'm guessing it has todo with the way backtrace or memoize is implemented?

Attached is the .g grammer file..
And also the testme.txt file on which this things segfaults itself.

btw. using cygwin


thanks for any help..
-H

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Ctree.g
Url: http://www.antlr.org/pipermail/antlr-interest/attachments/20080925/162be43b/attachment.pl 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: testme.txt
Url: http://www.antlr.org/pipermail/antlr-interest/attachments/20080925/162be43b/attachment.txt 


More information about the antlr-interest mailing list