This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Error unallocating mem!


Error unallocating mem!

Postby brendan » Jul 2, 2002 @ 10:25am

User avatar
brendan
pm Insider
 
Posts: 451
Joined: Oct 23, 2001 @ 2:51am
Location: Hobart, Australia


Postby brendan » Jul 2, 2002 @ 10:26am

User avatar
brendan
pm Insider
 
Posts: 451
Joined: Oct 23, 2001 @ 2:51am
Location: Hobart, Australia


Postby BurningSheep » Jul 2, 2002 @ 11:05am

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
Do you want custom Snails levels? Click
User avatar
BurningSheep
pm Insider
 
Posts: 1226
Joined: Apr 12, 2002 @ 11:49pm
Location: The Netherlands


Postby brendan » Jul 2, 2002 @ 11:20am

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!
User avatar
brendan
pm Insider
 
Posts: 451
Joined: Oct 23, 2001 @ 2:51am
Location: Hobart, Australia


Postby Dan East » Jul 2, 2002 @ 3:44pm

User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Postby angedelamort » Jul 2, 2002 @ 4:15pm

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 :)
User avatar
angedelamort
pm Member
 
Posts: 304
Joined: Mar 7, 2002 @ 11:16pm
Location: Montreal, Quebec


Postby britcode » Jul 3, 2002 @ 12:44am

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.
britcode
 


Postby brendan » Jul 3, 2002 @ 2:16am

Sorry, not illegal op, "Fatal Application Error"

Exception: 0x0000005
address: blah
Fatal Application Error
User avatar
brendan
pm Insider
 
Posts: 451
Joined: Oct 23, 2001 @ 2:51am
Location: Hobart, Australia


Postby BadBazza » Jul 5, 2002 @ 8:54am

Lost....... Assumed Coding!
User avatar
BadBazza
pm Insider
 
Posts: 81
Joined: Sep 21, 2001 @ 6:26am
Location: Blackpool, UK


Postby BadBazza » Jul 5, 2002 @ 11:31am

Lost....... Assumed Coding!
User avatar
BadBazza
pm Insider
 
Posts: 81
Joined: Sep 21, 2001 @ 6:26am
Location: Blackpool, UK


Postby Dan East » Jul 5, 2002 @ 3:08pm

That looks text-book correct to me.

Dan East
User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Postby BadBazza » Jul 9, 2002 @ 9:13pm

Thanks Dan,

I'll continue digging

Cheers
Bad
Lost....... Assumed Coding!
User avatar
BadBazza
pm Insider
 
Posts: 81
Joined: Sep 21, 2001 @ 6:26am
Location: Blackpool, UK


Postby cryo » Jul 11, 2002 @ 5:22pm

User avatar
cryo
pm Member
 
Posts: 204
Joined: Sep 19, 2001 @ 6:01am
Location: Bonn, Germany


Postby Dan East » Jul 11, 2002 @ 6:36pm

User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Postby refractor » Jul 11, 2002 @ 11:14pm

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.
User avatar
refractor
pm Insider
 
Posts: 2304
Joined: Feb 5, 2002 @ 1:12pm
Location: Luxembourg


Next

Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron