Re: +[NSData dataWithContentsOfURL:] leaks memory?
Re: +[NSData dataWithContentsOfURL:] leaks memory?
- Subject: Re: +[NSData dataWithContentsOfURL:] leaks memory?
- From: Lee Morgan <email@hidden>
- Date: Mon, 5 Dec 2005 22:18:20 -0500
I had (what seems) to be the same problem a few months back...
I "fixed" it by using NSURL's resourceDataUsingCache instead.
--- Lee ---
"The price of greatness is responsibility."
- Sir Winston Churchill
On Dec 5, 2005, at 5:43 PM, Mike Morton wrote:
All --
Our app loads a lot of data using +[NSData dataWithContentsOfURL:]
and this seems to use up memory, even though it loads inside the
scope of an autorelease pool.
Here’s a simple (I hope) example, which seems to grow without
bound. Each time it prints its own memory size, the size has grown
by 112Kb, exactly the size of the downloaded image.
A few years back (at http://www.cocoabuilder.com/archive/message/
cocoa/2002/3/15/62361 ) some folks discussed whether
+dataWithContentsOfURL: leaks, but I can’t find any workaround.
Does anyone know if NSURLHandle works better?
(I’m not sure it always uses up memory. Among the many testbed
tools I wrote while investigating this, I found some cases where
the memory does seem to get freed — sometimes upon loading an image
larget than the earlier ones. I figured I should stick with a
simple example…)
-- Mike
_______________________________________________
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