This is the mail archive of the
mailing list for the GCC project.
Re: behavior of egcs?
- To: Thomas Handler <th at umundum dot vol dot at>
- Subject: Re: behavior of egcs?
- From: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Date: 20 Mar 1998 14:58:15 -0300
- Cc: egcs-bugs at cygnus dot com
- References: <3512959D.2B491AFC@umundum.vol.at>
Thomas Handler writes:
> calling virtual member functions in the constructor doesn't seem to work
It does work, according to the C++ specification. When you're running
the constructor of the A sub-object of an instance of class B, the
object is not a B yet, so virtual dispatch finds A::s methods only.
> Occuring exceptions while creating objects via new in free store give
> memory leaks (section 14.4.4 Stroustrup C++ programming language 3rd ed.
> seems to define this as I would have expected).
I tested this with egcs 1.0., the problem was fixed.
> As an addition the thrown excepetion also causes memory leaks as you can
> see when uncommenting out the marked line in class Exception...
It's not an actual leak (in egcs 1.0.2); it will allocate the memory
only once. If you run the try/catch block in a loop a thousand times,
you'll get the same memory usage that you get for a single execution,
which proves the exception-handling area is reused.
Universidade Estadual de Campinas, SP, Brasil