Re: Help: How do you start debugging this crashlog?
Re: Help: How do you start debugging this crashlog?
- Subject: Re: Help: How do you start debugging this crashlog?
- From: "Andrew O. Mellinger" <email@hidden>
- Date: Sun, 20 Jul 2003 18:55:45 -0700
No, you think right. You only need to release or autorelease when
you have allocated, copied or retained an object. If you obtain an
object from any method that does not contain the words "alloc" or
"copy" in its name, then that object has already been autoreleased
and does not need to be released again unless you retain it.
Conversely, an object obtained from such a method needs to be
retained if you expect it to persist outside of the current event
(i.e. you should regard it as destroyed the moment the processor
returns to the framework).
Some OS X calls can consume a reference to an object. I'm fairly
new to Cocoa but have worked a bit with IOKit. In the the USB
portion whenever you use an allocated dictionary for matching
(IOServiceAddMatchingNotification), the call will consume on
reference and therefore it will be released (when that call is done
with it). So, if you want to use that matching dictionary again for
another matching request, you need to add additional retains. If you
forget to do this retain, it can be a real mess that can be difficult
to debug.
Does this sort of stuff happen in Cocoa or is it simply one of the
unique joys of IOKit?
-Andrew
--
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.