Re: -retain and -release Questions
Re: -retain and -release Questions
- Subject: Re: -retain and -release Questions
- From: Cameron Hayne <email@hidden>
- Date: Sun, 04 Apr 2004 22:14:25 -0500
On 3/7/04 2:20 AM, "Jerry Krinock" <email@hidden> wrote:
>
Generally, if I create (-alloc and -init) an object for temporary use only
>
within one method, I believe I need to -release this object before the
>
method returns. This is in contrast to C++, where objects are automatically
>
deleted when they go out of scope. Is this correct?
No - the situation is closer than you think.
Note that your Obj-C object variables hold pointers to the objects, not the
objects themselves. So the situation is analogous to calling 'new' to create
a temporary object - in that case the C++ object does not get deleted when
the (pointer) variable goes out of scope.
As to leak-detection utilities, there are some supplied by Apple as part of
the dev tools - look under /Developer/Applications.
--
Cameron Hayne (email@hidden)
Hayne of Tintagel
_______________________________________________
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.