androidperformanceandroid-studioandroid-profiler

How to show View Bitmap from Android v4 Profiler?


I tried to see why my native size has been bloated up. And it was mostly caused by Bitmap

enter image description here

I used Android Studio 4.1.1 I tried to find out and find that in the old Android Studio there would be "View Bitmap" on the right click menu or beside References Tab

But in this Studio I've seen nothing. How do I know which function create this much bitmap ?


Solution

  • The reason you don't see "View Bitmap" any more is because starting in Android 8.0 (API level 26), bitmap pixel data is stored in the native heap instead of the JVM heap (see here). Therefore on newer Android devices, the memory profiler won't have access to the pixel data from a heap dump. You should still be able to use "View Bitmap" when profiling a device older than Android 8.0.

    In order to see the stack trace of a particular bitmap, you may want to record memory allocations in the memory profiler: https://developer.android.com/studio/profile/memory-profiler#record-allocations.