Re: NSURL Tutorial?
Re: NSURL Tutorial?
- Subject: Re: NSURL Tutorial?
- From: "Steven W. Riggins" <email@hidden>
- Date: Sun, 28 Oct 2001 16:34:29 -0800
At 7:30 PM -0500 10/28/01, Scott Anguish wrote:
>
On Sunday, October 28, 2001, at 07:09 PM, Steven W. Riggins wrote:
>
>
>At 2:14 PM -0800 10/28/01, Steven W. Riggins wrote:
>
>>> imageData = [NSData dataWithContentsOfURL:imageURL];
>
>>> [imageData retain];
>
>>> image = [[NSImage alloc] initWithData:imageData];
>
>>>
>
>>>}
>
>>
>
>>Actually it looks like your way (telling the data to get the data, not the NSURL] does not leak.
>
>>
>
>
>
>I guess this leak still exists (see Andrew's email to me) when the URL is an HTTP url (and not file for example)
>
>
>
>
Well, give the above, I think that you're probably dealing with the imageData being retained when it doesn't need to be as well. NSImage initWithData doesn't appear to require that the data be retained when it is passed to it.
Right. Is this a bug as well? I sure wish Apple's doc dept would not assume we know how classes work and explictly state "initWithData retains the image data"
I prefer explicit definition over implied general function. :)
steve