What does Bitmap#recycle() in Android Honeycomb actually DO?

后端 未结 3 1666
無奈伤痛
無奈伤痛 2020-12-15 22:30

I am writing a very memory intensive application for Android Honeycomb, and I\'ve been very careful to recycle() unused Bitmaps wherever possible;

3条回答
  •  情书的邮戳
    2020-12-15 22:57

    Recycle frees the native memory that is allocated to the bitmap. The actual Bitmap object will remain in the Dalvik Heap until the next garbage collection (but the memory taken up by this object is insignificant).

    As far as I am aware, there really is no way to dump the native heap. So you won't be able to see if the bitmap's native data is gone via a heap dump. You should see, however, the total amount of memory your application is using go down. This question should help you discover the various ways to access the memory usage stats of your app.

提交回复
热议问题