Re: NSURLConnection: "Greedy Memory Eater" and Error 303
Re: NSURLConnection: "Greedy Memory Eater" and Error 303
- Subject: Re: NSURLConnection: "Greedy Memory Eater" and Error 303
- From: Jens Alfke <email@hidden>
- Date: Fri, 09 Sep 2011 13:42:34 -0700
On Sep 9, 2011, at 4:06 AM, Andreas Grosam wrote:
> I'm trying to use a NSURLConnection to download a large data file (>10 MB) from a web service to the iPhone. Currently, testing on iOS 4.2.1, on a device. The connection is established over WIFI.
>
> The problem I get with NSURLConnection is, that it internally uses a lot (really a lot) memory for its data buffers. It seems, the connection reads as much data as it can from the network and a tries to safe it in internal buffers, no matter what, apparently until the system cannot provide more memory.
That does seem wrong. I haven’t noticed such behavior, but I’ve been using NSURLConnection mostly on Mac OS. It is definitely used by many apps for large resources, though. I’ve used it for MP3 audio streaming, for example, and haven’t seen any excessive memory use.
You should repost this question on the macnetworkprog mailing list on this site. More of the networking experts hang out there — several Apple engineers with CFNetwork expertise reply to questions pretty regularly.
> Another problem is, if I process the incoming data buffers more "slowly", then it may occur that NSURLConnection returns the following error:
>
> Error Domain=kCFErrorDomainCFNetwork Code=303 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error 303.)"
According to CFNetworkErrors.h, this is kCFErrorHTTPParseFailure. That’s rather strange; I can’t think of any reason why slowing down reading the data would cause CFNetwork to have trouble parsing the HTTP response. What is the server on the other end? (Actually, don’t answer that here; but you could include that info when you repost to the macnetworkprog list.)
—Jens_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden