views:

133

answers:

3

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?

+4  A: 

in main.m file (in X-code it is in "Other Sources" folder)

oxigen
is that the only one?
Thanks
+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
+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