Re: Main Thread autorelease pool, memory usage question?
Re: Main Thread autorelease pool, memory usage question?
- Subject: Re: Main Thread autorelease pool, memory usage question?
- From: "Michael Ash" <email@hidden>
- Date: Mon, 15 Dec 2008 22:47:02 -0500
On Mon, Dec 15, 2008 at 9:53 PM, Chad Podoski <email@hidden> wrote:
> I have a process that is uploading images. My issue is as following, when
> uploading a large number of images and my application does not have focus,
> memory usage continues to climb until it is maxed out, causing the app to
> hang/crash. On the other hand, if the app has focus and the user clicks
> anywhere in the app, memory is released and memory usage stays low. While
> this is occurring in the main thread, the actually connection work is being
> done in a separate thread (via ConnectionKit). The action of the user
> clicking in the app appears to trigger an interrupt, allowing memory to be
> released or the main thread to manage its autorelease pools. Couple of
> questions:
>
> 1) Why is the main thread not managing the autorelease pool(s) without this
> user interrupt?
> 2) Is there a way to trigger the main thread to cleanup its autorelease
> pools?
> 3) If not, is there a way to simulate the user click or trigger the same
> underlying reaction to it, programmatically?
> 4) Am I completely off base with my hypothesis?
In order, because it's dumb, post a dummy NSEvent, no need, and you're right on.
This is a *very* longstanding AppKit bug and at this point I guess
it's never going to get fixed.
Details on exactly what's going on and how to work around it here:
http://www.mikeash.com/?page=pyblog/more-fun-with-autorelease.html
The good news is that the workaround is really easy. The bad news is
that you need it at all.
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden