In iOS app development, we are using NSAutoreleasePool to relinquish ownership of objects at a later point in time.
But why can it be shared between different threads?
Why do we need to create a new autoreleasepool when I wanted to use a new thread?
EDIT:
As taskinoor mentioned my question was why this is designed in such a way that each thread should have a separate autoreleasepool.
The design challenge for multi-thread autorelease pools is when to drain them. If you drain the pool while an object is still being used, then you will crash. Per thread, it’s easy to tell when you are outside the run loop and thus at a point where autoreleased objects can be drained. In a multi-thread situation, your threads would need to be synchronized at the end of their runloop so you can be sure you are at a safe point to drain them. Synchronized treads in this way is a bad idea, it creates lots of idle time and slows down the program.