new to memory mgmt
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.