Re: Initializing an Array
Re: Initializing an Array
- Subject: Re: Initializing an Array
- From: "John C. Randolph" <email@hidden>
- Date: Tue, 22 Jan 2002 11:58:45 -0800
I would expect that result if aString was nil. If you're
getting a valid string passed in, then you're looking at a bug.
Do you have a test case you can send me?
-jcr
On Tuesday, January 22, 2002, at 11:47 AM, Jeff Galyan wrote:
>
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
>
_______________________________________________
>
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.
>
>
"Only in a police state is the job of a policeman easy." - Orson Welles