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

Open 1 Answers 42 Views Technology

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

1 Answer

0

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

}

by (236k points)
...