This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: delete not called



  On Fri, 17 April 1998, Warner Losh wrote:
  > In message <13622.59339.352264.243086@hal2.dyn.ml.org> Tudor Hulubei writes:
  > : Is this a known problem?
  > 
  > It is doing the right thing.

I don't think so.  Do you mean that the space for Y is never
deallocated?  What does the fact that ~X is virtual has anything to do 
with deallocation?

  > 
  > : class X { public: ~X() {} };
  > : class Y : public X {};
  > 
  > You need to make ~X virtual.

I already tried that, before reporting the bug.  In fact, in my code
~X() _was_ virtual when I noticed the leak.  Try to make ~X() virtual
and you'll see that you still get 2 calls to new and one call to
delete.  Again, gcc-2.8.1 is working fine as do older versions of egcs
(I tried egcs 1.0 and it used to work with older snapshots).

Regards,
Tudor


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]