Message-ID: <3AB2BCD3.4020002@operamail.com> From: Sahab Yazdani Organization: PheonixSoft Interactive User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; m18) Gecko/20001204 X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: the follies of new... Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Lines: 57 Date: Fri, 16 Mar 2001 20:24:35 -0500 NNTP-Posting-Host: 149.99.118.73 X-Complaints-To: abuse AT sprint DOT ca X-Trace: newscontent-01.sprint.ca 984792645 149.99.118.73 (Fri, 16 Mar 2001 20:30:45 EST) NNTP-Posting-Date: Fri, 16 Mar 2001 20:30:45 EST To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com my program keeps crashing to a call to delete every second time my function is ran. so something like this: void foo() { bar = new bar(); delete bar; } void main() { foo(); // This runs fine foo(); // This will crash } I'm checking out the pointers now as this probably where the error origintaes. the problem is that using fprintf to print the address of the pointer, i get a rather strange result: void foo() { bar = new bar(); fprintf( stderr, "bar[afterinit]: %x\n", bar ); fprintf( stderr, "bar[beforedestruct]: %x\n", bar ); delete bar; } the strangeness is that the first time this function is called I get this (these are actual results of my program, obvoisly using function foo as an example): bar[afterinit]: 0x45eb8 bar[ondestruct]: 0x45eb8 bar[oninit]: 0xff4f31f0 bar[ondestruct]: 0xff4f31f0 SIGSEGV afterwards this shows that the pointer doesn't shift, so the code is okay, but the address of the second set of pointers points to memory in the 4GB region, which my computer doesn't have (although I wish it did :-)). now when I run symify on the traceback I get a function called ___builtin_delete as the final function to be called before the program crashes. could it be that the memory allocation technique in djgpp is a bit messed up?? or much more likely that my code is messed up. hope somebody can help me with this. -- *********************************************************** * Sahab Yazdani * "Wizard's Third Rule: Passion rules * * Thornhill S.S * Reason" - Kolo's Journal * *********************************************************** * http://pheonixsoft.virtualave.net/ * ***********************************************************