Welcome to Emulationworld

Forum Index | FAQ | New User | Login | Search

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

SubjectRe: weird c++ destructor behaviour Reply to this message
Posted byElSemi
Posted on01/28/04 09:26 AM

hmm, 0x00 at the end of an allocated memory, it's just a guess, but maybe you are allocating n bytes to copy a n chars long string, but you really need n+1 bytes due to the \0 at the end.

> 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 05:25 PM
.*fixed :)  Terry Bogard01/28/04 11:33 AM
..*Re: fixed :)  Bart T.01/28/04 04:10 PM
...*Re: fixed :)  Terry Bogard01/28/04 05:53 PM
..Re: weird c++ destructor behaviour  ElSemi01/28/04 09:26 AM
.*Re: weird c destructor behaviour  finaldave01/27/04 11:13 PM
..*Re: weird c destructor behaviour  smf01/28/04 08:18 AM