1.

Who calls the dealloc strategy? Would we be able to implement dealloc in ARC? In the event that indeed, what is the need to do that?

Answer»

Dealloc is termed as a result of memory management. Once an objects “retainCount” reaches zero, then a dealloc message is mechanically sent there to OBJECT. You should never DECISION dealloc on objects unless it's a decision to [super dealloc]; at the tip of Associate in Nursing OVERRIDDEN dealloc.

Example

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

}



Discussion

No Comment Found