help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re[2]: memory leaks


From: Laurence Finston
Subject: Re[2]: memory leaks
Date: Wed, 8 Jun 2005 10:59:46 +0200 (MEST)

On Tue, 7 Jun 2005, hz kto wrote:

>
>
> If I have a list like this wouldn't I run into the problem when,
> a parent node deletes some child nodes, then when I come across
> this child in the list, I will crash since it has been deleted already?

That was the point of the following remark:

> > Depending on circumstances, it might be advantageous for 'object'
> > to refer to a 'Foo**' rather than a 'Foo*'.

If this is unclear, I will be happy to provide an example.

If you only ever delete objects by means of their corresponding
'Object_Type::object' pointers, than it would be safe to use simple
pointers to 'Foo*'.

In the list structure as illustrated, a node has only a single
subsequent element, so it's not possible for a node to have multiple
children.  Nor is it possible to step through the list backwards.
Of course, it would be possible to use a doubly-linked list or
a tree instead.

>
> Ugrading to 2.0 is not easy, since different parts of software are using
> Bison, which is slightly modified too, and I have no knowledge whether
> it is going to impact those parts. It is an option, of course, that
> I will investigate.
>

In the long run, I think it's probably a good idea to upgrade,
whether you use '%destructor' or not.

Laurence




reply via email to

[Prev in Thread] Current Thread [Next in Thread]