My Android app has a custom AsyncTask to make a call to rest for a list of objects. I use Jackson to convert my answer to Java, and I see about 30 garbage collector calls when matching Json via ObjectMapper.readValue (). Interestingly, if I make the same call a second, third, fourth time (by selecting the refresh button), there will be only one GC call. Any ideas why this happens on the first call every time I launch an Android app?
AsyncTask.java
doInBackground() { HttpGet request = new HttpGet(url); HttpClientUtil.setJsonAccept(request); HttpResponse response = httpClient.execute(request); HttpEntity responseEntity = new BufferedHttpEntity(response.getEntity()); // Call that garbage collect 30+ times the first exectution ArrayList<MyObject> responseCollection = mapper.readValue(responseEntity.getContent(), new TypeReference<ArrayList<MyObject>>(){}); return responseCollection; }
LogCat Output
07-10 11:05:13.484: D/dalvikvm(5518): GC_CONCURRENT freed 497K, 5% free 14030K/14727K, paused 3ms+4ms 07-10 11:05:13.484: D/dalvikvm(5518): GC_CONCURRENT freed 497K, 5% free 14030K/14727K, paused 3ms+4ms 07-10 11:05:13.484: D/dalvikvm(5518): GC_CONCURRENT freed 497K, 5% free 14030K/14727K, paused 3ms+4ms ...
source share