What is 0xFEEEFEEE?
Posted on 2003-03-24
I'm seeing this value in an access violation that occurs when my program is trying to clean up after itself. All of my "delete <some pointer>" statements are wrapped in an "if(<some pointer>)" block which I thought would prevent this kind of thing. However, a certain pointer seems to be changing to 0xfeeefeee on me and, since that isn't NULL, my program (specifically the destructor of the class the pointer is a member of) tries to delete it and, to quote from The Crow, "Bang! $%&*! I'm dead!" Every delete statement in my code is followed by an assignment of that pointer to NULL so I'm not sure how it changes. Since I see 0xfeeefeee every time, I don't think it's an overwrite.
I sent the wondrous Google out after my new nemesis and found a few links that explain it as a magic number of sorts that the MSVC debug memory manager uses to indicate certain things about a memory block. Nothing goes into much detail however. So I was hoping that someone here could explain 0xfeeefeee and its apparent friends 0xbaadfood, 0xcdcdcdcd, etc.
How/when do pointers get changed to these bogus addresses? Should I check for these values along with NULL before I delete them or would that just be a band-aid because the appearance of this value indicates a misstep/inefficiency on my part that I should correct?