[antlr-interest] Memory management of C target

Jim Idle jimi at temporal-wave.com
Wed Feb 2 09:01:27 PST 2011


I think that the fix is in there, which means that your input is too big
to build the tree in the way it is being done. Write an input stream
wrapper that splits the input by just returning EOF at the split point
then resets to the next unit.

How are you ending up with 640,000 lines of C input?

Jim


> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Marco Trudel
> Sent: Wednesday, February 02, 2011 8:20 AM
> To: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Memory management of C target
>
> Dear Jim
>
> On 01.02.2011 18:15, Jim Idle wrote:
> > <snip>
> >
> > I think
> > that in 3.3 I have fixed a bug that was not releasing memory
> > references when building a tree until the tree was freed. Try making
> a
> > version that does not build a tree and see how it differs.
> >
> > <snip>
>
> Ok, made a version of my grammar that doesn't build a tree:
>
> libantlr3c-3.2, no tree output: works, uses about 600mb memory
> libantlr3c-3.2, tree output: crash, wants more than 2gb
>
> libantlr3c-3.3-SNAPSHOT, no tree output: works, uses about 630mb memory
> libantlr3c-3.3-SNAPSHOT, tree output: crash, wants more than 2gb
>
> The only changes to the grammar where removing/adding "output = AST;".
> Is your fix already in the current SNAPSHOT?
>
>
> Thanks
> Marco
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address


More information about the antlr-interest mailing list