Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

What is 0xFEEEFEEE?

Posted on 2003-03-24
3
Medium Priority
?
10,083 Views
Last Modified: 2013-11-20
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?
0
Comment
Question by:mastethom
3 Comments
 
LVL 11

Expert Comment

by:KurtVon
ID: 8197929
Well, one place I've seen this sort of thing happen is when the pointer pointed to a varable that went out of scope:

void DoBang()
{
    int* extrapointer = null;

    if (!extrapointer)
    {
        int value = 20;
        extrapointer = &value;
    }

    *extrapointer = 3; // BANG!
}

Of course, it usually isn't so obvious, unfortunately.  And there are other possible causes.
0
 
LVL 1

Accepted Solution

by:
MarkusLoibl earned 400 total points
ID: 8201800
In the msdn-artice

Troubleshooting Common Problems with Applications: Debugging in the Real World

Mark Long
Microsoft Corporation
October 2000

you find:

Table 1. Potential patterns Pattern Description

0xFDFDFDFD No man's land (normally outside of a process)
0xDDDDDDDD Freed memory
0xCDCDCDCD Uninitialized (global)
0xCCCCCCCC Uninitialized locals (on the stack)

see:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs600/html/debugging.asp
0
 

Author Comment

by:mastethom
ID: 8203511
Thanks guys, I think what's happening with my code is that a destructor is getting called twice.  I'm not sure how yet but a TRACE statement inside shows this to be the case.  This is a Bad Thing and I hope solving it takes care of the problem.

Markus, that article helped the most, I think.  It didn't reference my magic number specifically but it said they were subject to change and I've found some more information on these as a whole.  I think you'll get the points and I'll get to the bookstore and see about that book the article mentions.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question