in Technology by (1.8m 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 (1.8m 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.

(void)dealloc

{

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

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

}

Related questions

0 votes
asked Aug 3 in Education by JackTerrance (1.8m points)
...