From 701a3c2ad6fcb80f814c4011f1ed56c56ea26d39 Mon Sep 17 00:00:00 2001 From: benfry Date: Sun, 31 Jul 2011 21:43:39 +0000 Subject: [PATCH] fix for http problem with grabbing too much memory --- android/core/src/processing/core/PApplet.java | 8 +++++--- android/todo.txt | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/android/core/src/processing/core/PApplet.java b/android/core/src/processing/core/PApplet.java index 749e50d9f..afa6a59da 100644 --- a/android/core/src/processing/core/PApplet.java +++ b/android/core/src/processing/core/PApplet.java @@ -57,7 +57,6 @@ import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.HttpResponse; import org.apache.http.HttpEntity; -import org.apache.http.entity.BufferedHttpEntity; import java.net.URI; @@ -4049,8 +4048,11 @@ public class PApplet extends Activity implements PConstants, Runnable { HttpClient httpclient = new DefaultHttpClient(); HttpResponse response = (HttpResponse) httpclient.execute(httpRequest); HttpEntity entity = response.getEntity(); - BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity(entity); - return bufHttpEntity.getContent(); + return entity.getContent(); + // can't use BufferedHttpEntity because it may try to allocate a byte + // buffer of the size of the download, bad when DL is 25 MB... [0200] +// BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity(entity); +// return bufHttpEntity.getContent(); } catch (MalformedURLException mfue) { // not a url, that's fine diff --git a/android/todo.txt b/android/todo.txt index 5517e6e1c..cf66fb92e 100644 --- a/android/todo.txt +++ b/android/todo.txt @@ -1,4 +1,6 @@ 0200 android +X fix BufferedHttpEntity problem +X was trying to allocate a byte buffer for entire size of HTTP file _ Android mode does not recognize library imports _ http://code.google.com/p/processing/issues/detail?id=766