Re: Garbage collection - was Beginner with Cocoa
Re: Garbage collection - was Beginner with Cocoa
- Subject: Re: Garbage collection - was Beginner with Cocoa
- From: "Rob Napier" <email@hidden>
- Date: Tue, 25 Mar 2008 19:02:12 -0400
On Tue, Mar 25, 2008 at 6:15 PM, Randall Meadows <email@hidden>
wrote:
> On Mar 25, 2008, at 4:07 PM, Nick Zitzmann wrote:
> >
> > On Mar 25, 2008, at 4:01 PM, Jack Repenning wrote:
> >> On Mar 25, 2008, at 2:06 PM, Scott Ribe wrote:
> >>> There's a *very* simple set of rules to follow regarding retain/
> >>> release.
> >>
> >> Yes, but where are they documented?
> >
> >
> >
> <file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/chapter_3_section_5.html
> > >
>
> I was thinking <
> http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Concepts/ObjectOwnership.html#//apple_ref/doc/uid/20000043
> >.
If people will read nothing but "Practical Memory Management" (the page
after the one you linked here, and all of 1500 words long), they will be
fine for nearly everything. By the time they need more than that one page,
they will probably know what they don't know and be able to figure it out.
When I got started, Cocoa memory management scared me too, and yet I seldom
run into memory problems (except in Objective-C++) much as I thought they
would plague me. If 1500 words are too much to read, read these two
sentences from "Practical Memory Management" (which echo everything that has
been said here) and 90% of your problems will go away:
"Sometimes it might seem tedious or pedantic, but if you use accessor
methods consistently the chances of having problems with memory management
decrease considerably. If you are using retain and release on a class's
instance variables throughout your code, you are almost certainly doing the
wrong thing."
And XCode will write those accessors for you.
-Rob
--
Rob Napier -- Software and Security Consulting -- http://robnapier.net
_______________________________________________
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