Why do we need to use NSAutoreleasepool for each thread?

In the development of iOS applications, we use NSAutoreleasePoolto give up ownership of objects at a later point in time.

But why can it be split between different threads?

Why do we need to create a new autoreleasepool when I want to use a new thread?

EDIT:

As already mentioned, my question is explained by why it is designed in such a way that each thread must have a separate autoreleasepool.

+5
source share
4 answers

- . , , . , , , , , . runloop, , , . - , .

+5

: , , .

+2

. , , . 100%, , . - , . , , . . .

+1

I don’t think autoplay pools are split between threads, according to Cocoa's apple memory management guide, each thread has its own stack of abstract pools

If you do not create an autorun pool for streams that you create or disconnect, then the autodetection function does not work, so the amount of memory will grow

0
source

All Articles