Hey all,
I am looking for some help regarding a memory issue. I make multiple
POST requests on a REST server to receive data based on the user
action.
Everything seems to work fine with no problem but on my login screen
the user enters his credentials to login. The credentials are checked
online. As I debug I notice my HEAP size for every request which
starts at 2.7MB increases approximately by 150-300kb every HTTP
request. The response data itself, without the http headers is around
400 BYTES only.
For example:
HEAP SIZE: 2.7MB
request()
HEAP SIZE ~= 3.088MB
request()
HEAP SIZE ~= 3.250MB
The request and response are always the same as I am debugging but the
number increase is not the same for each call.
Additionally the heap size stops increasing (or I have not tried
enough requests?) around 3.8-4.0MB.
Here is my code for the request:
HttpPost post = new HttpPost(server);
post.setHeader(HTTP.CONTENT_TYPE,
"application/x-www-form-
urlencoded");
post.setEntity(new StringEntity(params));
HttpResponse response = client.execute(post);
if (response.getStatusLine().getStatusCode() == 200) {
String s =
EntityUtils.toString(response.getEntity());
response = null;
return s;
}
The client.execute(post) is the line that increases the HEAP size. I
have even tried removing the .setHeader line but with no luck.
Is there a better way to manage Http POST requests for Android phones?
I would hate to see to lose 1MB of memory just because the user has
typed his password wrong 3 times.
Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---