I am wondering how many there are, and where they are. As I have seen in a Stanford Vid, there is one autorelease pool installed in the event loop of an iPhone App. But I think I missed the point where exactly that is? And are there any other autorelease pools that I should know about?
is that the only one?
Thanks
2009-04-28 16:35:15
+2
A:
The application's autorelease pool drains every pass through the run loop. You can add your own pool anywhere you want, if you have a big loop that creates a lot of objects it can be a good idea to put a pool there to limit memory usage.
Marc Charbonneau
2009-04-28 13:37:46
+1
A:
Every thread that you create needs its own autorelease pool. Check the documentation for NSThread
for details.
Your main application thread, by default, will use the one created in main.m
. Unless you're doing a bunch of big operations like Marc Charbonneau said, you generally don't need to create others. And if you're really doing that many operations, it might be a good idea to do them in a separate thread anyway.
Marco
2009-04-28 14:51:23