• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [OBJC newbie] - Intance variable becomes 'invalid'
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: Re: [OBJC newbie] - Intance variable becomes 'invalid' (From: Graham <email@hidden>)

  • Prev by Date: Re: Exposing Methods in a Framework
  • Next by Date: Re: NSWorkspace launchApplication: vs NSAppleScript
  • Previous by thread: Re: Re: [OBJC newbie] - Intance variable becomes 'invalid'
  • Next by thread: Re: Re: [OBJC newbie] - Intance variable becomes 'invalid'
  • Index(es):
    • Date
    • Thread