• 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: Andres Santiago Perez-Bergquist <email@hidden>
  • Date: Sun, 30 Nov 2003 16:09:45 -0500

On 30 Nov 2003, at 3:57 PM, pmcurry wrote:

NSData* data = [[notice userInfo] objectForKey: NSFileHandleNotificationDataItem];
NSString* string = [[NSString alloc] initWithData: data encoding: [NSString defaultCStringEncoding]];
NSArray* components = [string componentsSeparatedByString:@"\n"];

Can I assume these three lines are using 'convenience type' calls and I'm not responsible for releasing any of the objects created in the process? I'm still memory gun-shy.

Correct for the first and third lines, wrong for the second. Whenever you alloc or copy, the resulting object has a retain count of one.

-- Andres Santiago Perez-Bergquist
_______________________________________________
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: 
 >newbie memory question (From: pmcurry <email@hidden>)

  • Prev by Date: newbie memory question
  • Next by Date: Method not called when target is Development?
  • Previous by thread: newbie memory question
  • Next by thread: Re: newbie memory question
  • Index(es):
    • Date
    • Thread