-retain and -release Questions
-retain and -release Questions
- Subject: -retain and -release Questions
- From: Jerry Krinock <email@hidden>
- Date: Sat, 06 Mar 2004 23:20:08 -0800
Hi,
From a C++ background, I'm learning to use -retain and -release with some
difficulty. I have difficulty understanding much of the document "Object
Ownership and Disposal":
file:///Developer/Documentation/Cocoa/Conceptual/MemoryMgmt/Concepts/ObjectO
wnership.html#//apple_ref/doc/uid/20000043/BEHDEDDB
Now, I'm learning when to use -retain OK, because of the big fat crash which
occurs whenever I omit one. But -release is more tricky.
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?
Am I correct in saying that the only bad effect of omitting a -release or
-autorelease message is that it causes a memory leak?
Is there a tool to check my Obj-C/Cocoa app for such memory leaks? (I use
CodeWarrior, but of course I have XCode available, if there is anything
built to them).
Thanks
Jerry Krinock
San Jose, CA USA
_______________________________________________
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.