Re: NSWindowController retain counts, chapter 2
Re: NSWindowController retain counts, chapter 2
- Subject: Re: NSWindowController retain counts, chapter 2
- From: "Shawn Erickson" <email@hidden>
- Date: Tue, 7 Oct 2008 11:51:05 -0700
On Tue, Oct 7, 2008 at 11:42 AM, James Walker <email@hidden> wrote:
> Shawn Erickson wrote:
>>
>> On Tue, Oct 7, 2008 at 11:05 AM, James Walker <email@hidden>
>> wrote:
>>
>>> I think the important thing is that the window was not getting
>>> deallocated.
>>> After more experimentation, this seems to be another symptom of the same
>>> basic problem as in my previous NSWindowController thread, which is that
>>> a
>>> Carbon app using WaitNextEvent still needs to set up and release its own
>>> autorelease pools each time through the event loop. When I do that, the
>>> problem goes away. And unlike my previous workarounds, this doesn't make
>>> me
>>> feel like I'm doing voodoo.
>>
>> Have you looked at the console log or run log if running from Xcode
>> for messages like the following?
>>
>> *** _NSAutoreleaseNoPool(): Object <SomeObjectPointer> of class
>> <SomeClassName> autoreleased with no pool in place - just leaking
>
> No, there is no such message.
>
>> Of course you may not be seeing those if you have a top level
>> auto-release pool setup, say in your main entry point, that simply
>> exists for the life of the application. If you do have such a top
>> level auto-release pool that exists for the life of the application
>> consider knocking it out (at least temporarily) to help you detect
>> code pathways that are using Cocoa API yet they are not correctly
>> managing an auto-release pool.
>
> No, I don't have such a top-level autorelease pool, and I don't know why
> anyone would.
Based on what you are describing it sure sounds like some long lived
auto-release pool exists that is collecting objects to release yet
isn't being draining in a timely fashion.
>> (of course I do wonder why you are still using Carbon event
>> management, it really is time to be switching off of that)
>
> Because I still have a bunch of PowerPlant windows, and changing the event
> management seemed riskier than not doing so.
Not knowing your target market or time line for your this project...
but the future is fairly quickly approaching and that future has
limited support for Carbon based UI (at least in one branch of the
world). You may want to pay the price sooner rather then later.
-Shawn
_______________________________________________
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