Re: updating UI during long loop using cocoa objective-c
Re: updating UI during long loop using cocoa objective-c
- Subject: Re: updating UI during long loop using cocoa objective-c
- From: Keary Suska <email@hidden>
- Date: Mon, 02 Apr 2007 08:53:08 -0600
- Thread-topic: updating UI during long loop using cocoa objective-c
on 4/2/07 6:31 AM, email@hidden purportedly said:
>> However one thing -runModalSession does not do is autoreleasing, so
>> your modal session code might need to manage it's own autorelease
>> pools.
>
> Wow! Where did you read that, Bob? I have not allocced any
> autorelease pools for my modal sessions, but neither have I seen any
> of those "autoreleased with no pool in place -- just leaking"
> messages in Console.
The issue, as I understand it, is not that there *aren't* any autorelease
pools, but that the main autorelease pool isn't released until the modal
session ends. If you need to do a lot of object creation/destruction, you
may want to manage your own pool for the modal loop.
However, when using beginModalSession/runModalSession you can call the main
run loop after runModalSession using:
[[NSRunLoop currentRunLoop] runUntilDate:
[NSDate dateWithTimeIntervalSinceNow:0.1]];
This trick has many (desirable) side effects, one of which is releasing the
main autorelease pool.
Best,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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