Skip navigation.
 
mlRe: [OBJC newbie] - Intance variable becomes 'invalid'
FROM : Joshua Pennington
DATE : Wed May 31 21:36:37 2006

Memory management with Cocoa is not that hard, you just have to get 
used to the process. A simple rule of thumb is: if you call alloc, 
then you must release it when done.

Everytime you retain something, you need to release it. Usually, if 
you don't call alloc, it's autoreleased and it needs to be retained 
if you wish to use it later. Along with that call to retain, a 
matching call to release is needed when you are done with it.

On a side note: It's rumored that garbage collection will be coming 
to Objective-C with the release of Leopard.

Joshua

On May 31, 2006, at 2:15 PM, Graham wrote:

> I was getting the instance from an NSXMLDocument's node's name.
> retain fixed it.
> (In Java of course, if you have a reference to it, then it does not 
> go away)
> Yikes, this is like going back to the dark ages.
> Of course, it means that I will have to become more diligent 
> (better?).
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list      (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>

Related mailsAuthorDate
ml[OBJC newbie] - Intance variable becomes 'invalid' Graham May 31, 20:51
mlRe: [OBJC newbie] - Intance variable becomes 'invalid' Moray Taylor May 31, 20:54
mlRe: [OBJC newbie] - Intance variable becomes 'invalid' John Stiles May 31, 20:54
mlRe: [OBJC newbie] - Intance variable becomes 'invalid' Chas Spillar May 31, 20:56
mlRe: [OBJC newbie] - Intance variable becomes 'invalid' Robert Walker May 31, 20:58
mlRe: [OBJC newbie] - Intance variable becomes 'invalid' Chas Spillar May 31, 20:59
mlRe: Re: [OBJC newbie] - Intance variable becomes 'invalid' Graham May 31, 21:15
mlRe: [OBJC newbie] - Intance variable becomes 'invalid' Joshua Pennington May 31, 21:36
mlRe: Re: [OBJC newbie] - Intance variable becomes 'invalid' Shawn Erickson May 31, 21:55
mlRe: Re: Re: [OBJC newbie] - Intance variable becomes 'invalid' Graham May 31, 22:14
mlRe: [OBJC newbie] - Intance variable becomes 'invalid' Scott Ellsworth May 31, 22:46
mlRe: [OBJC newbie] - Intance variable becomes 'invalid' Sherm Pendley May 31, 23:06