title: Memory leaks, singleInstance
body: <p>I've got a couple of activities where I display images with help of <a href="https://github.com/thest1/LazyList/blob/master/src/com/fedorvlasov/lazylist/ImageLoader.java" rel="nofollow noreferrer">this lib</a>. The thing is the app is running out of memory. I tried to gc.clean(), null references, call clear on imageloader object but in vain.</p>
  
  <p>In MAT i've found out that I have multiple objects of the same activity and it a default behaviour, if I'm not mistaken. I used singleInstance to suppress multiple instances and it has helped with memory leaks.</p>
  
  <p>Right now, due to singleInstance, I'm having troubles with navigation. Do you think I should continue with singleInstance or try to fix memory leak with multiple instances ?</p>
  
  <p>Here's ImageView gc roots inspection:
  <img src="https://i.stack.imgur.com/iDHCE.jpg" alt="enter image description here"></p>
  
  <p>UPD:</p>
  
  <pre><code> Bitmap bitmap=null;
          URL imageUrl = new URL(url);
          HttpURLConnection conn = (HttpURLConnection)imageUrl.openConnection();
          conn.setConnectTimeout(30000);
          conn.setReadTimeout(30000);
          conn.setInstanceFollowRedirects(true);
          InputStream is=conn.getInputStream();
          OutputStream os = new FileOutputStream(f);
          Utils.CopyStream(is, os);
          os.close();
          bitmap = decodeFile(f);
          return bitmap;
  
      ImageView imageView = (ImageView) convertView;
      if(convertView == null){
          imageView = new ImageView(_currentActivity);
      }
  </code></pre>
  
  <p>UPD2(navigation strategies):</p>
  
  <p>I've got a constant header with buttons which start home activity(with gallery) and profile activity; secondly there's a subheader wich also holds 3 buttons which point to another 3 activities with listviews(consisting of imageviews + labels).</p>
  
  <p>These header, subheader elements are available on every activity in application; The link-buttons do nothing but:</p>
  
  <pre><code>startActivity(new Intent(getActivity(), MainActivity.class));
  </code></pre>
  
  <p>or</p>
  
  <pre><code>Intent activityIntent = new Intent(getActivity(), SomeActivityWithListViewInside.class);
  // passing some data like list id
  activityIntent.putExtra("list_id", listId);
  startActivity(activityIntent);
  </code></pre>
  
  <p>So, those activity instances are caused by those startActivity calls - do you think I should play with singleTop or any other intent parameter to avoid this issue ?</p>