Message-Id: <199803071051.MAA55246@ieva06.lanet.lv> From: "Andris Pavenis" To: djgpp AT delorie DOT com, Charles Terry Date: Sat, 7 Mar 1998 12:48:41 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: Class undestructible !!! In-reply-to: <3500637E.273D@plinet.com> Precedence: bulk > From: Charles Terry > 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