I need to make bunch of http requests(around 500) from Async Task. For that purpose i am using HttpClient. After around 200 requests i get this on LogCat:
I/dalvikvm-heap(25912): Grow heap (frag case) to 9.321MB for 526096-byte allocation D/dalvikvm(25912): GC_CONCURRENT freed 3K, 1% free 9516K/9612K, paused 3ms+1ms, total 24ms
When this occurs, async task is paused(code stops being executed). I assumed that i am using too much memory, so i`ve made those static class variables so they are allocated only once:
static HttpClient httpClient = new DefaultHttpClient();
static HttpContext localContext = new BasicHttpContext();
static HttpGet httpGet = new HttpGet();
Everything else is being set to null after usage. Also i`ve tried setting large heap requirement in Manifest "android:largeHeap="true"", but stil same problem occurs.
I cant figure out what am doing wrong. I know that requirement for 500 http request is very demanding, but there must be solution. Any ideas?