Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

priyank.ranka

macrumors member
Original poster
Jun 11, 2008
51
0
Hi EveryOne,
I know its basic question that i should know but i don't know. Please help me by giving some brief comments on what exactly is the difference between the dealloc method and release method. I am developing a game in which initially when game was over i used to dealloc all the UIImageView objects and used to transfer the control to main menu and when user clicks start game button it alloc all the UIImageView objects. But during the course of game play, game gets deactivated and error splashes on debugger screen is " EXE_BAD_SIGNAL". But the issue was slove when i replaced dealloc by release message. But i don't know what is the exact difference. I went through memory management guide but still didn't get the answer. PLease help me out.
 

xsmasher

macrumors regular
Jul 18, 2008
140
0
Short answer:
Each object keeps a count of how many times it has been retained. Calling "release" reduces that count by one - it does not necessarily get rid of the object, if someone else has retained it. Dealloc is the real deal - the object will be destroyed.

You should not, as far as I know, ever call dealloc (other than [super dealloc] at the end of your own dealloc method.) It will get called by "release" if no one else is retaining the object (When the count has gone to 0.)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.