What happens when you call autorelease on an object?

  
Showing Answers 1 - 5 of 5 Answers

Tarun Sharma

  • Oct 7th, 2011
 

When you create a object with auto release it is added to the auto release pool of the system and the objects retain count is decremented when the auto release pool is flushed in the next cycle. So basically as the name suggests auto release objects are auto released by the system, no object owns them. If you want to use these objects later your object needs to retain it and then release it when you are done.

  Was this answer useful?  Yes

PRASAD

  • Apr 26th, 2012
 

Simple we call an Object as "autorelease" object....dealloc will be managed by compiler....no need to write release method...

  Was this answer useful?  Yes

Nagaraj

  • May 31st, 2012
 

Autorelease is used because the object is needed some where before terminate it is released after application is ended.

  Was this answer useful?  Yes

Thanaraj

  • Mar 13th, 2013
 

When ever you call auto release to a object.. , the Object will be added to the auto release pool of the system. when the system faces the lack of memory, the system starts to release (remove)the objects in pool. so that.. till the system clears the object from pool , object will be there in memory.
Prefer to release whenever possible. But I should point out that most of memory leaks are caused by forgetting to add the release line, so it would probably be better to just tack on the auto release right away. Here I am point out again "release whenever possible".

  Was this answer useful?  Yes

Anubhav Giri

  • Sep 15th, 2014
 

Autorelease release the object automatically, which we have allocate in the memory. Autorelease is a concept of ARC.
ARC is Automatic Reference Counting which provides facility to user that the objects which are allocates in memory can release automatically.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions