[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: When to free RHS tokens?
From: |
Hans Åberg |
Subject: |
Re: When to free RHS tokens? |
Date: |
Tue, 27 Dec 2016 14:42:28 +0100 |
> On 27 Dec 2016, at 00:48, William Brannon <address@hidden> wrote:
> My question is: do the actions for these productions need to
> explicitly deallocate memory associated with the unused tokens? I
> believe not, because:
> o) the tokens don't have types, so they're just #define'd to integers,
> o) which is why bison doesn't warn about unused tokens, and which implies
> o) there's no memory to deallocate.
>
> But I can't find a solid answer to this question online. If it
> matters, this is a C++ parser...
In C++, the parser stack is a std::deque container, which will deallocate all
that is automatically deallocated by C++, but not explicit operator new(),
malloc() etc.