0 votes
in Technology by (323k points)

Who calls dealloc method? Can we implement dealloc in ARC? If yes, what is the need to do that?

1 Answer

0 votes
by (323k points)

dealloc is called as a result of memory management. Once an objects “retainCount” reaches 0 then a dealloc message is automatically sent to that object.

You should never call dealloc on objects unless it is a call to [super dealloc]; at the end of an overridden dealloc.



[ivar release]; //Release any retained variables before super dealloc

[super dealloc]; //Only place in your code you should ever call dealloc