www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/07/05:48:54

Message-Id: <199803071051.MAA55246@ieva06.lanet.lv>
From: "Andris Pavenis" <pavenis AT laima DOT acad DOT latnet DOT lv>
To: djgpp AT delorie DOT com, Charles Terry <cterry AT plinet DOT com>
Date: Sat, 7 Mar 1998 12:48:41 +0000
MIME-Version: 1.0
Subject: Re: Class undestructible !!!
In-reply-to: <3500637E.273D@plinet.com>

> From:          Charles Terry <cterry AT plinet DOT com>
> Subject:       Re: Class undestructible !!!
> Date:          Fri, 06 Mar 1998 13:06:05 -0800
> Organization:  All USENET -- http://www.Supernews.com
> To:            djgpp AT delorie DOT com

> Mauro Toniolo wrote:
> > 
> > I have created a class to handle with the matrixes. When I compile a listing
> > that uses the class with the default destroyer, after a few iteration I get
> > an overflow memory error. Surely, it's due by the wrong management of the
> I looked at your class and yes if you use new() in the constructor it
> needs to have a corresponding delete called.
> > memory with this kind of destroyer. But if I define a destroyer like the
> > following, I get the error below NOT in compiling time BUT in executing
> > time. Why? HOW CAN I DESTROY THAT OBJECT?
> > 
> .....
>  
> > Attached you can find the class I wrote:
> > 
> > --------------------
> > Exiting due to signal SIGSEGV
> Your destructor looks fine.
> After a brief look, your destructor looks fine to me.
> A guess is that one of the objects being deleted in not allocated
> or has been made to point elsewhere.
> 
> run gdb on the program and when it fails call the stack and check
> your values.
> Personally thats one of the things I like about protected mode
> programing is that these kind of problems get picked up on the spot.
> 
> good luck
> Charles Terry
> 

One more note. I recomment to use such package as Fortify to track down 
memory related problems such as perhaps occurs in this case. Here is URL:

  http://www.geocities.com/SiliconValley/Horizon/8596/fortify.html

I used for long time old version 1.0 and haven' still tested 2.2 but I 
think it must help. It helped me much in debugging various 
applications in C++.

Andris

 

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019