Re: Memory Management: Revamped Engine Example
Re: Memory Management: Revamped Engine Example
- Subject: Re: Memory Management: Revamped Engine Example
- From: Scott Ribe <email@hidden>
- Date: Sat, 31 Dec 2005 17:38:41 -0700
- Thread-topic: Memory Management: Revamped Engine Example
>
[engineParts addObject:[[CombustionChamber alloc]
>
init]];
The array engineParts will retain the objects you add to it, so that ought
to be [engineParts addObject:[[[CombustionChamber alloc] init] autorelease]]
and so on (and in the maintenance method as well), since you're not keeping
a pointer to the parts elsewhere and presumably want them freed sometime
after engineParts is freed and the current autorelease pool is released.
The same point goes for the NSNumber objects you're inserting into the bad
parts array in main. Except that instead of alloc/init/autorelease you can
use the appropriate convenience class method like so: [NSNumber
numberWithInt: 0].
--
Scott Ribe
email@hidden
http://www.killerbytes.com/
(303) 665-7007 voice
_______________________________________________
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