Reputation: 1622
I am debuging with Visual Studio 2008. I allocate a large buffer (around 12MB) using
buf = new unsigned char[bigValue];
Later when I deallocate the buffer using delete[] buf;
, I see "?? ?? ?? ??" values in the debug memory window. Usually I see "fe ee fe ee". Is there something going wrong with my memory management that I'm not seeing?
I found a couple of related questions:
Why I can only see “??” at any address before 0x70000
In Visual Studio C++, what are the memory allocation representations?
but they don't answer this question.
Upvotes: 1
Views: 890
Reputation: 355307
Usually, the ??
means that that part of the process address space is not mapped. That is, those addresses are no longer in use by the process. To observe this behavior directly, you can VirtualAlloc
a block of memory, watch it in the Memory window, then VirtualFree
it, releasing it back to the OS.
The 0xfe
flag is a sentinel value with which the debug heap fills freed memory that is still owned by the heap. If you deallocate a very large block of memory, it is likely that it will be released back to the OS immediately, rather than being returned from the heap.
Upvotes: 4