• 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: newbie memory question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: newbie memory question


  • Subject: Re: newbie memory question
  • From: Chris Hanson <email@hidden>
  • Date: Mon, 1 Dec 2003 13:16:25 -0600

On Dec 1, 2003, at 4:06 AM, M. Uli Kusterer wrote:
At 18:25 Uhr -0600 30.11.2003, Chris Hanson wrote:
The memory management rules are pretty clear on what all o the above is.

NSData *data = [[notice userInfo] objectForKey: NSFileHandleNotificationDataItem];

This gets a value from the dictionary. There's no use of +alloc or -copy so you have to assume you don't own the object and it's autoreleased. If you want to own it you have to retain or copy it.

Actually, this is *not* autoreleased. It is owned by the dictionary. Which means as soon as the dictionary goes away, this object may disappear as well.

I didn't say it was autoreleased, I said you had to assume it was. So if you want to own it you have to retain or copy it, otherwise it will go away whenever its owner does.

A little bit of a nitpick, I know.

-- Chris

--
Chris Hanson <email@hidden>
bDistributed.com, Inc.
Outsourcing Vendor Evaluation
Custom Mac OS X Development
Cocoa Developer Training
_______________________________________________
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.

References: 
 >Re: newbie memory question (From: "M. Uli Kusterer" <email@hidden>)

  • Prev by Date: Re: MutableArrays losing its contents?
  • Next by Date: Re: contracting strings with "..."
  • Previous by thread: Re: newbie memory question
  • Next by thread: Re: reading keys from a plist file
  • Index(es):
    • Date
    • Thread