Welcome to Emulationworld

Forum Index | FAQ | New User | Login | Search

Make a New PostPrevious ThreadView All ThreadsNext ThreadShow in Flat Mode*

Subjectweird c++ destructor behaviour Reply to this message
Posted byTerry Bogard
Posted on01/27/04 12:25 PM

I'm using VC++ 6.0 under Windows XP.

I'm coding the functionalities of a very basic POP3 client. I have all the job made by a "POP3" class which cares about the network connection, the parsing of the server's responses and the storage of messages.

Everything seems to be working fine, except the destructor: whenever I try to free the memory allocated for the arrays of chars containing the messages, a debug window with three buttons pops up. It's the old "continue, abort, debug" window, except that it's blank: no text on it.

I have checked everywhere else in my code to make sure no variable still points to that memory area, and I've followed a step by step debug to see what's wrong, but I wasn't able to understand what is the problem with those delete's.

For every delete, the debug console reports something like: "memory check error at 0x00348514 = 0x00, should be 0xFD" which makes little sense to me: why does the debugger check memory values while I am deallocating memory? What is it looking for, exactly?

Also, this problem occurs only with debug builds: release builds report no errors of sort, and the program terminates gracefully.

If anybody has a clue about what goes on exactly, I'd appreciate that.

I haven't posted source code here because the destructors contains just loops of delete's, but it's no big secret, I even thought to make it available online as public domain once polished, so feel free to ask if you think it's useful.

Thanks in advance.

Entire Thread
Subject  Posted byPosted On
.weird c++ destructor behaviour  Terry Bogard01/27/04 12:25 PM
.*fixed :)  Terry Bogard01/28/04 06:33 AM
..*Re: fixed :)  Bart T.01/28/04 11:10 AM
...*Re: fixed :)  Terry Bogard01/28/04 12:53 PM
.*Re: weird c++ destructor behaviour  ElSemi01/28/04 04:26 AM
.*Re: weird c destructor behaviour  finaldave01/27/04 06:13 PM
..*Re: weird c destructor behaviour  smf01/28/04 03:18 AM