Page 1 of 2

Error unallocating mem!

PostPosted: Jul 2, 2002 @ 10:25am
by brendan

PostPosted: Jul 2, 2002 @ 10:26am
by brendan

PostPosted: Jul 2, 2002 @ 11:05am
by BurningSheep
offtopic but it looks kinda strange using unsigned short and PIXEL, why not do:
PIXEL* all_zone_items_p = new PIXEL[300 * 120];

neways, new should return a null pointer when unable to allocate memory, probably is a good habit to check that especially when allocating larger portions of memory (I usually still use malloc and free).
But your program would probably crash much earlier when you're trying to use a null pointer and I don't believe delete would do anything when given a null pointer.

besides this I don't see any errors in the code, so why it's not working... i don't know

PostPosted: Jul 2, 2002 @ 11:20am
by brendan
I'm sure there's a reason im using unsigned short instead or pixel, but im not sure why.....mmm then again maybe not!.... maybe it's because the reference in easyce to the "real screen" location was defined as a US, I just copied it... No idea really!

in anycase does not fix problem!

PostPosted: Jul 2, 2002 @ 3:44pm
by Dan East

PostPosted: Jul 2, 2002 @ 4:15pm
by angedelamort
I had exactly the same problem. I was allocating in the constructor and deallocationg the array in the destructor... Even when I debugged, everything was correct. So, For now I just let the OS delete it for me lol. But, maybe in your case it's because you try to delete it 2 times?

Have fun debugging :)

PostPosted: Jul 3, 2002 @ 12:44am
by britcode
Sounds like a heap corruption to me, the worst kind of bug. If you don't find it now, it'll crop up later on. It's not a good idea to ignore it.

PostPosted: Jul 3, 2002 @ 2:16am
by brendan
Sorry, not illegal op, "Fatal Application Error"

Exception: 0x0000005
address: blah
Fatal Application Error

PostPosted: Jul 5, 2002 @ 8:54am
by BadBazza

PostPosted: Jul 5, 2002 @ 11:31am
by BadBazza

PostPosted: Jul 5, 2002 @ 3:08pm
by Dan East
That looks text-book correct to me.

Dan East

PostPosted: Jul 9, 2002 @ 9:13pm
by BadBazza
Thanks Dan,

I'll continue digging

Cheers
Bad

PostPosted: Jul 11, 2002 @ 5:22pm
by cryo

PostPosted: Jul 11, 2002 @ 6:36pm
by Dan East

PostPosted: Jul 11, 2002 @ 11:14pm
by refractor
Are you sure that the memory from the malloc call was actually allocated? I've had things die on me when I accidentally tried to release a null pointer before - sometimes it works, sometimes it doesn't.

That doesn't explain why the deletion of the array isn't working though.