• 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
new to memory mgmt
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

new to memory mgmt


  • Subject: new to memory mgmt
  • From: pmcurry <email@hidden>
  • Date: Sun, 15 Feb 2004 12:04:06 -0800

Just looking for some reassurance that I'm starting to understand some parts of memory mgmt.

Code fragment:

switch ( message ) {
<snip>
case: kBegin
Node n = [[Node alloc] init];
[n setRank:a];
[n setParent:b];
[n setState:c];
[tree addObject:n]
[n release];
break;
<snip>
} // switch

The node n gets a retain from the array tree and I need to send a release since I used alloc/init.
So the retain count for n went from 1 (alloc/init) to 2 (addObject) to 1 (release) and all should be good.

Thanks.
-Phil
_______________________________________________
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.

  • Follow-Ups:
    • Re: new to memory mgmt
      • From: Troy Dawson <email@hidden>
  • Prev by Date: RE: What to do with a bad nib?
  • Next by Date: Re: ANN: Doxygen for MacOS X with Objective-C support
  • Previous by thread: Re: calling method via IMP that returns non id type - compiler warning
  • Next by thread: Re: new to memory mgmt
  • Index(es):
    • Date
    • Thread