Re: [OBJC newbie] - Intance variable becomes 'invalid'
Re: [OBJC newbie] - Intance variable becomes 'invalid'
- Subject: Re: [OBJC newbie] - Intance variable becomes 'invalid'
- From: Joshua Pennington <email@hidden>
- Date: Wed, 31 May 2006 14:36:37 -0500
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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden