title: excessive garbage collector in android for AsyncTask
body: <p>i am trying to download json object using URL, for that i have created one AsyncTask. Whenever i am starting my application, excessive garbage collector starts. i cant understad where i am going wrong.i am not performing any heavy memory usage task just trying to call api for json response.</p>
  
  <p><strong>MainActivity Code :</strong></p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
  
  public class DownloadTask extends AsyncTask&lt;String,Void,String&gt;{
  
      @Override
      protected String doInBackground(String... urls) {
  
          String result=null;
          URL url;
          HttpURLConnection httpURLConnection=null;
  
          try {
              url= new URL(urls[0]);
              httpURLConnection= (HttpURLConnection) url.openConnection();
              InputStream inputStream= httpURLConnection.getInputStream();
              InputStreamReader inputStreamReader= new InputStreamReader(inputStream);
              int data= inputStreamReader.read();
              while(data !=1){
                  char current= (char) data;
                  result +=current;
                  data= inputStreamReader.read();
              }
              return result;
  
          } catch (MalformedURLException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          }
          return null;
      }
  
      @Override
      protected void onPostExecute(String result) {
          super.onPostExecute(result);
          Log.i("webssite Content :",result);
      }
  }
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      DownloadTask downloadTask= new DownloadTask();
      downloadTask.execute("http://api.openweathermap.org/data/2.5/weather?q=London&amp;appid=5868b18238384fb4bdb3123jn9f0847cc");
  }}
  </code></pre>
  
  <p><strong>Logcat</strong></p>
  
  <pre><code>06-19 08:45:57.149 6269-6283/com.hemkar.jsondemo D/dalvikvm: GC_FOR_ALLOC freed &lt;1K, 28% free 4438K/6144K, paused 3ms, total 3ms
  06-19 08:45:57.149 6269-6283/com.hemkar.jsondemo I/dalvikvm-heap: Grow heap (frag case) to 5.091MB for 720030-byte allocation
  06-19 08:45:57.149 6269-6283/com.hemkar.jsondemo D/dalvikvm: GC_FOR_ALLOC freed 468K, 24% free 4672K/6144K, paused 6ms, total 6ms
  06-19 08:45:57.159 6269-6283/com.hemkar.jsondemo D/dalvikvm: GC_FOR_ALLOC freed 1172K, 36% free 3969K/6144K, paused 5ms, total 5ms
  06-19 08:45:57.159 6269-6283/com.hemkar.jsondemo D/dalvikvm: GC_FOR_ALLOC freed &lt;1K, 28% free 4438K/6144K, paused 3ms, total 3ms
  06-19 08:45:57.159 6269-6283/com.hemkar.jsondemo I/dalvikvm-heap: Grow heap (frag case) to 5.091MB for 720034-byte allocation
  06-19 08:45:57.159 6269-6283/com.hemkar.jsondemo D/dalvikvm: GC_FOR_ALLOC freed 468K, 24% free 4672K/6144K, paused 3ms, total 3ms
  06-19 08:45:57.169 6269-6283/com.hemkar.jsondemo D/dalvikvm: GC_FOR_ALLOC freed 1172K, 36% free 3969K/6144K, paused 3ms, total 3ms
  06-19 08:45:57.169 6269-6283/com.hemkar.jsondemo D/dalvikvm: GC_FOR_ALLOC freed &lt;1K, 28% free 4438K/6144K, paused 2ms, total 2ms
  06-19 08:45:57.169 6269-6283/com.hemkar.jsondemo I/dalvikvm-heap: Grow heap (frag case) to 5.091MB for 720036-byte allocation
  06-19 08:45:57.179 6269-6283/com.hemkar.jsondemo D/dalvikvm: GC_FOR_ALLOC freed 468K, 24% free 4672K/6144K, paused 4ms, total 4ms
  06-19 08:45:57.179 6269-6283/com.hemkar.jsondemo D/dalvikvm: GC_FOR_ALLOC freed 1172K, 36% free 3969K/6144K, paused 3ms, total 3ms
  06-19 08:45:57.189 6269-6283/com.hemkar.jsondemo D/dalvikvm: GC_FOR_ALLOC freed &lt;1K, 28% free 4438K/6144K, paused 7ms, total 7ms
  06-19 08:45:57.189 6269-6283/com.hemkar.jsondemo I/dalvikvm-heap: Grow heap (frag case) to 5.091MB for 720040-byte allocation
  06-19 08:45:57.189 6269-6283/com.hemkar.jsondemo D/dalvikvm: GC_FOR_ALLOC freed 468K, 24% free 4672K/6144K, paused 3ms, total 3ms
  06-19 08:45:57.199 6269-6283/com.hemkar.jsondemo D/dalvikvm: GC_FOR_ALLOC freed 1172K, 36% free 3969K/6144K, paused 2ms, total 2ms
  06-19 08:45:57.199 6269-6283/com.hemkar.jsondemo D/dalvikvm: GC_FOR_ALLOC freed &lt;1K, 28% free 4438K/6144K, paused 3ms, total 3ms
  06-19 08:45:57.199 6269-6283/com.hemkar.jsondemo I/dalvikvm-heap: Grow heap (frag case) to 5.091MB for 720042-byte allocation
  06-19 08:45:57.199 6269-6283/com.hemkar.jsondemo D/dalvikvm: GC_FOR_ALLOC freed 468K, 24% free 4672K/6144K, paused 3ms, total 3ms
  06-19 08:45:57.209 6269-6283/com.hemkar.jsondemo D/dalvikvm: GC_FOR_ALLOC freed 1172K, 36% free 3969K/6144K, paused 3ms, total 3ms
  06-19 08:45:57.219 6269-6283/com.hemkar.jsondemo D/dalvikvm: GC_FOR_ALLOC freed &lt;1K, 28% free 4438K/6144K, paused 5ms, total 5ms
  06-19 08:45:57.219 6269-6283/com.hemkar.jsondemo I/dalvikvm-heap: Grow heap (frag case) to 5.091MB for 720046-byte allocation
  06-19 08:45:57.229 6269-6283/com.hemkar.jsondemo D/dalvikvm: GC_FOR_ALLOC freed 468K, 24% free 4672K/6144K, paused 4ms, total 4ms
  06-19 08:45:57.229 6269-6283/com.hemkar.jsondemo D/dalvikvm: GC_FOR_ALLOC freed 1172K, 36% free 3969K/6144K, paused 2ms, total 2ms
  06-19 08:45:57.239 6269-6283/com.hemkar.jsondemo D/dalvikvm: GC_FOR_ALLOC freed &lt;1K, 28% free 4438K/6144K, paused 5ms, total 5ms
  06-19 08:45:57.239 6269-6283/com.hemkar.jsondemo I/dalvikvm-heap: Grow heap (frag case) to 5.091MB for 720048-byte allocation
  06-19 08:45:57.239 6269-6283/com.hemkar.jsondemo D/dalvikvm: GC_FOR_ALLOC freed 468K, 24% free 4672K/6144K, paused 4ms, total 4ms
  06-19 08:45:57.249 6269-6283/com.hemkar.jsondemo D/dalvikvm: GC_FOR_ALLOC freed 1172K, 36% free 3969K/6144K, paused 4ms, total 4ms
  06-19 08:45:57.249 6269-6283/com.hemkar.jsondemo D/dalvikvm: GC_FOR_ALLOC freed &lt;1K, 28% free 4438K/6144K, paused 5ms, total 5ms
  06-19 08:45:57.249 6269-6283/com.hemkar.jsondemo I/dalvikvm-heap: Grow heap (frag case) to 5.091MB for 720052-byte allocation
  06-19 08:45:57.259 6269-6283/com.hemkar.jsondemo D/dalvikvm: GC_FOR_ALLOC freed 468K, 24% free 4672K/6144K, paused 5ms, total 5ms
  06-19 08:45:57.259 6269-6283/com.hemkar.jsondemo D/dalvikvm: GC_FOR_ALLOC freed 1172K, 36% free 3969K/6144K, paused 3ms, total 3ms
  06-19 08:45:57.269 6269-6283/com.hemkar.jsondemo D/dalvikvm: GC_FOR_ALLOC freed &lt;1K, 28% free 4438K/6144K, paused 8ms, total 8ms
  06-19 0
  </code></pre>