Re: NSPopAutoreleasePool
Re: NSPopAutoreleasePool
- Subject: Re: NSPopAutoreleasePool
- From: Chris Hanson <email@hidden>
- Date: Mon, 13 Sep 2004 13:20:53 -0700
On Sep 13, 2004, at 4:35 AM, Sunil wrote:
I tried a lot , but i am unable to resolve this issue. I am doing a
Cocoa App which is behaving abnormally. It gives the following log and
crashes . I think these are something due to releasing the objects
which are there in autorelease pool. But i am unable to figure them
out. Can anyone please help me in figuring it out. Please send me your
suggestions.
As Allan suggested, NSZombieEnabled can help you track down
multiple-release crashes. But the best defense against
multiple-release crashes is to be careful to always follow the Cocoa
memory management conventions:
(1) If you get an object from an +alloc, -copy..., -mutableCopy... or
+new... method, you own it and are responsible for releasing it with
-release or -autorelease.
(2) If you retain an object, you are responsible for releasing it with
-release or -autorelease.
(3) If you get an object in any other way, you don't own it and must
assume it has already been sent -autorelease. If you want to hang onto
it, you need to either -retain it (see #2 above) or make a copy of it
(see #1 above), depending on the semantics you require.
-- Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden