?
Solved

What is 0xFEEEFEEE?

Posted on 2003-03-24
3
Medium Priority
?
9,789 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: 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: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

762 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