Skip to main content
GameDev.net gamedev.net
🔒 Locked

HEAP error

Started by xan Jan 23, 2004 at 2:18 AM 1 replies 900+ views
Original Post
xan
xan
Hi I have a problem in VC++ 6.0 with an allocation and I can''t find the cause.. Somewhere in the code I do a really bad thing with one variable or so; when I debug the code I get the following message in the output window: HEAP[my_program_name.exe]: Invalid allocation size - fffffffc (exceeded 7ffdefff) If someone can tell me what can cause this error or how I could find the way to it (in the code). Breakpoints are no good here.. Sure, I could start watching the behavior of dynamically generated variables, but seems everything ok to me. Thanks
x@n
Agony
Agony
I don't remember seeing that, but I'm taking a wild guess that fffffffc is actually suppose to be a signed number, not an unsigned number, so 0xFFFFFFFC = -4. That would imply that somewhere you might be trying to do something like:

char* pCharArray;
pCharArray = new char[SomeCalculatedSize];
and SomeCalculatedSize happens to equal -4, which would be interpreted as an unsigned long, instead of a signed long, which would then equal 4294967292 (~4 gig), which is more memory than you're allowed to allocate. The 0x7FFDEFFF equals 2147348479 (~2 gig) which I believe is the max that any typical Win32 program can allocate.

Hope that helps.

[Edit - I was previously allocating ints, not chars, so my example was actualy allocating 16 gigs, not 4 gigs like I had stated]

[edited by - Agony on January 23, 2004 12:07:55 PM]
"We should have a great fewer disputes in the world if words were taken for what they are, the signs of our ideas nly, and not for things themselves." - John Locke o

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.