when destroy, set null:

 mImg.setBackgroundDrawable(null);


On Jul 15, 9:53 am, 嘿嘿 <[email protected]> wrote:
> I testing in the demo of
> $android-sdk-root/docs/resources/articles/avoiding-memory-leaks.html(the
> code like below). After a lot of orientation change, I got a hprof. Under
> the dominator tree view(Eclipse Memory Analyzer), I found there is a lot of
> Bitmap with Unknown type as a GC root(the attachment hprof.jpg).
>
> I have two question
> 1. When the GC root will be recylced? Never be?
> 2. The Retained Heap of a Bitmap is only 32, And I heard about the raw data
> is at native. But can I measure the precise memory the Bitmap used in
> native?
>
> Note:
> my emulator is 2.2 froyo
>
> **************************************************
> Code
> **************************************************
>     private ImageView mImg;
>
>     private static Drawable sBackground;
>
>     /** Called when the activity is first created. */
>     @Override
>     public void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>         setContentView(R.layout.main);
>
>         mImg = (ImageView) findViewById(R.id.img);
>
>         if (sBackground == null) {
>             sBackground = getResources().getDrawable(R.drawable.desk);
>         }
>         mImg.setBackgroundDrawable(sBackground);
>     }
> **************************************************
>
>  hprof.jpg
> 792KViewDownload

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to