Re: Initializing an Array
Re: Initializing an Array
- Subject: Re: Initializing an Array
- From: Jeff Galyan <email@hidden>
- Date: Tue, 22 Jan 2002 12:47:06 -0700
I didn't think so, but when I wasn't sending retain to the copied string,
the app would crash on the first call to any method in the class, and the
debugger showed myString's address as 0x0.
--Jeff
On 1/22/02 12:42 PM, "John C. Randolph" <email@hidden> wrote:
>
>
On Tuesday, January 22, 2002, at 10:57 AM, Jeff Galyan wrote:
>
>
>
> - (id)initWithString:(NSString *)aString
>
> {
>
> myString = [aString copy];
>
> [myString retain];
>
>
This is a leak. You don't need to -retain something that you've copied.
>
>
-jcr
>
>
John C. Randolph <email@hidden> (408) 974-8819
>
Sr. Software Engineer, Cocoa Evangelism
>
Apple Worldwide Developer Relations