[antlr-interest] C runtime Memory Usage

Bot Tiger bottiger1 at gmail.com
Fri Jan 23 19:36:34 PST 2009


I just found out that pANTLR3_BASE_TREE->getChild() returns the same node in
memory, but pANTLR3_BASE_TREE->getText() creates an entirely new
pANTLR3_STRING even when called from the same node.

Does anyone have any suggestions for making this function return the same
string? I thought it would've returned a single string from a lexer
structure.

On Fri, Jan 23, 2009 at 7:22 PM, Bot Tiger <bottiger1 at gmail.com> wrote:

> Hello, I am using the C runtime and experiencing heavy memory usage.
>
> I am interpreting an AST tree recursively.
>
> In each interpret call, I am checking the token text by using
> pANTLR3_BASE_TREE->getText()->chars.
> Am I suppose to manually free this when I am done with it?
>
> Also, I am recursively calling the children nodes with
> pANTLR3_BASE_TREE->getChild().
> Am I also supposed to free these as well? I was assuming that they returned
> only 1 copy of the node.
>
> Thank you.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090123/5f1db907/attachment.html 


More information about the antlr-interest mailing list