delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/06/15:30:58

From: Charles Terry <cterry AT plinet DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Class undestructible !!!
Date: Fri, 06 Mar 1998 13:06:05 -0800
Organization: All USENET -- http://www.Supernews.com
Lines: 29
Message-ID: <3500637E.273D@plinet.com>
References: <6dpdau$6ql AT everest DOT vol DOT it>
NNTP-Posting-Host: 2682 AT 207 DOT 174 DOT 3 DOT 208
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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

- Raw text -


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