Archived

This topic is now archived and is closed to further replies.

xan

HEAP error

Recommended Posts

xan    122
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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
check out :

http://www.softwareverify.com/index.html

an industrial strength memory validator. You have a 30 day trial, it''s pretty ez to use. I just tried it myself.

Good Luck!

-ddn

Share this post


Link to post
Share on other sites
Agony    3452
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]

Share this post


Link to post
Share on other sites