AutoReleasePool 学习笔记

1. In a reference-counted environment, an NSAutoreleasePool contains objects that have received autorelease message. When the pool drained, it sends release message to each of the objects.

2. The Application Kit creates an autorelease pool for main thread at the beginning of every cycle of the event loop. We can create "local" autorelease pool.

3. Can NOT retain or autorelease an autorelease pool.

4.  Should always drain an autorelease pool in the same context that it was created.

4. Each thread maintains its own stack of NSAutoreleasePool objects.  When a thread terminates, it automatically drains all of the autorelease pools associated with itself.

猜你喜欢

转载自lisai.iteye.com/blog/1725766