Explain what is the stack of autorelease pools. How autorelease pool work under the hood?



Explain what is the stack of autorelease pools. How autorelease pool work under the hood?..

Answer / Arpit Shukla

In Objective-C, Autorelease Pool is a runtime mechanism that manages memory allocation for objects. The stack of Autorelease Pools in iOS helps manage memory during the execution of an app's event loop.
1. When you create an object with `alloc` and set it to an autoreleased variable using `autorelease`, it is added to the current autorelease pool.
2. When the autorelease pool drains (usually at the end of an event loop iteration), the objects are sent a release message, which decreases their retain count by one.
3. If the retain count becomes zero, the object is deallocated and its memory is freed.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Apple iOS Interview Questions

Does ios supports multi-tasking functionality?

1 Answers  


What is a delegate xcode?

1 Answers  


Have you uploaded app on appstore? What is the process?

1 Answers  


Explain the difference between frame and bounds?

1 Answers  


Explain about Viewcontroller lifecycle.

1 Answers  


How to send your device id to an iphone developer?

1 Answers  


How to parse json?

1 Answers  


What is nsobject in ios?

1 Answers  


Describe @objc inference?

1 Answers  


Explain UIApplication life cycle

1 Answers  


What are ios protocols?

1 Answers  


What is the meaning of 'strong'keyword?

1 Answers  


Categories