Re: retain, copy, release, autorelease...leak
Re: retain, copy, release, autorelease...leak
- Subject: Re: retain, copy, release, autorelease...leak
- From: email@hidden
- Date: Thu, 28 Jun 2001 16:32:36 -0400
> myArray = [[NSMutableArray arrayWithCapacity: 10] retain];
You do not need to retain or release objects created with class methods
(arrayWithCapacity: is a class method for NS*Array), only those created
with [[... alloc] init*:] methods.
>NSColor *colorStore;
>colorStore = [self Quicky];
>//[colorStore release];
You crash when you call autorelease because you haven't actually created
(allocated, initialized, retained) an NSColor object. You need to create
it with a method like [NSColor redColor] or [[NSColor alloc] init*]. I
think you're getting memory leaks 'cause you're putting pointers to
objects that don't exist into myArray.
-- Robert Lee Dotson
"If we aren't supposed to eat animals, why are they made of meat?"