On Sun, Aug 10, 2008 at 8:04 PM, Matt Neuburg <[EMAIL PROTECTED]> wrote: > That's perhaps perfectly true. But "later" could be a LOT later - and in the > meantime quite a lot of memory could pile up. For example, it is the nature > of the Cocoa event loop that the autorelease pool gets cleaned out when the > user switches to another app and back to your app. But that might not happen > for quite some time.
I was under the impression that Cocoa flushed the top autorelease pool at the top of the runloop. But this is an Implementation Detail, after all. > To cite an example in my own life, in an app where I > was creating a lot of autoreleased strings as I gathered data from a huge > MySQL database, I actually caused my computer to freeze up for lack of > memory. When I created my own autorelease pool and released it every n times > thru the loop, the problem went away. This is, indeed, an *extremely* common > technique for doing exactly what you say - making it happen "now". Believe me, I'm very familiar with this technique. I have an app that draws a lot of little rounded rectangles, and it's important that I don't just create a ton of autoreleased NSBezierPaths, but instead explicitly alloc and release them. Otherwise my working set grows dramatically. > So, to resume, it may in fact be that the OP's app is NOT truly "leaking" - > but rather, that exactly what I'm describing here is what's happening to > him: the built-in autorelease pool is just piling up and not getting > released, because the event loop hasn't exited yet. The fact that the > problem he is seeing does in fact go away for him when he does what I > suggested is an indication that it is. This is one of the possible > conclusions towards which, in my Socratic little way, I'm trying to lead the > OP. Stay tuned. m. Or maybe it has something to do with him explicitly retaining the autoreleased NSArrays he's creating, and inappropriately using usleep instead of an NSTimer... --Kyle Sluder _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]