mttkay / ignition

Kick-starts Android application development.
1.28k stars 290 forks source link

IgnitedHttpResponseImpl relies on BufferedHttpEntity which blows up memory limits for large entities #48

Open robertoandrade opened 11 years ago

robertoandrade commented 11 years ago

When trying to consume a large entity via IgnitedHttpResponseImpl it seems like the replacement of the original entity by a BufferedHttpEntity in its implementation seems to allocate memory for the the entire length of the entity you're trying to download.

So say you have a 100MB file for instance, it will try to allocate that much memory to fetch the InputStream of the HttpEntity (which by the name - buffered - you'd expect it to stream the contents via an internal buffer or sorts rather than cache the entire stream).

Do you guys have any suggestions to overcoming this issue given AbstractHttpClient seems to call entity.consumeContent() right after the initialization of the response by IgnitedHttpRequestBase.handleResponse()?

zabawaba99 commented 11 years ago

I'm having a similar issue in where I'm expect a HttpResponse with an entity that has a content length of 125 MB. As IgnitedHttpRequestBase.handleResponse() is called, the BufferedHttpEnity allocated 125MB worth of memory for the application and causes an outOfMemoryException.

Is there any plan to change the implementation in the future?