title: how to release bitmap memory in android
body: <p>In our program wo use lots of images,we unbindDrawables in eyery Activity and Fragment as below     </p>
  
  <pre><code>protected void unbindDrawables(View view) {
      if (view != null) {
          if (view.getBackground() != null) {
              view.getBackground().setCallback(null);
          }
          if (view instanceof ImageView) {
              ImageView imageView = (ImageView) view;
              imageView.setImageDrawable(null);
          }
          if (view instanceof ViewGroup &amp;&amp; !(view instanceof AdapterView)) {
              for (int i = 0; i &lt; ((ViewGroup) view).getChildCount(); i++) {
                  unbindDrawables(((ViewGroup) view).getChildAt(i));
              }
              if (!(view instanceof AbsSpinner) &amp;&amp; !(view instanceof AbsListView)) {
                  ((ViewGroup) view).removeAllViews();
              }
          }
      }
  }
  </code></pre>
  
  <p>like this <a href="https://stackoverflow.com/a/6779067">https://stackoverflow.com/a/6779067</a> said,but I use the mat find that the bitmap also use a lots of memory and not release.</p>
  
  <pre><code>Class Name                               |   Objects | Shallow Heap | Retained Heap
  
   android.graphics.Bitmap                 |       490 |       23,520 | &gt;= 36,267,912
   android.graphics.Bitmap$1               |         1 |            8 |          &gt;= 8
   android.graphics.Bitmap$2               |         0 |            0 |         &gt;= 80
   android.graphics.Bitmap$BitmapFinalizer |       490 |        7,840 |      &gt;= 7,840
   android.graphics.Bitmap$CompressFormat  |         3 |           72 |        &gt;= 232
   android.graphics.Bitmap$CompressFormat[]|         1 |           24 |         &gt;= 24
   android.graphics.Bitmap$Config          |         4 |           96 |        &gt;= 360
   android.graphics.Bitmap$Config[]        |         2 |           72 |         &gt;= 72
   android.graphics.BitmapFactory          |         0 |            0 |         &gt;= 80
   android.graphics.BitmapFactory$Options  |         0 |            0 |              
   android.graphics.BitmapRegionDecoder    |         0 |            0 |         &gt;= 48
   android.graphics.BitmapShader           |         9 |          216 |     &gt;= 15,736
   Total: 12 entries (4,509 filtered)      |     1,000 |       31,848 |              
  </code></pre>
  
  <p>I don't know why it not be released and how to release it,any body can help me,thanks a lot!</p>