• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: updating UI during long loop using cocoa objective-c
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: updating UI during long loop using cocoa objective-c
      • From: Bob Smith <email@hidden>
References: 
 >Re: updating UI during long loop using cocoa objective-c (From: Jerry Krinock <email@hidden>)

  • Prev by Date: [Meeting] Toronto Area Cocoa and WebObjects Developer Group - April 10, 2007
  • Next by Date: Re: error displaying @count via bindings
  • Previous by thread: Re: updating UI during long loop using cocoa objective-c
  • Next by thread: Re: updating UI during long loop using cocoa objective-c
  • Index(es):
    • Date
    • Thread