How to find identifiers or names of preloaded system drawings (bitmaps) from a memory dump

I analyze the memory usage in our application and found a strange Drawablesone that constantly "eats" a few megabytes of heap. Here are some screenshots from MAT :

Dominator tree Dominator tree with two fairly large bitmaps

path_to_gc_roots GC root path for one of the above bitmaps

These bitmaps are always displayed in heaps from my phone (Samsung Galaxy Nexus, OS 4.1.1), no matter how long or how intensively I use our application.

MAT - . , , width height , 512x512: bitmap_info

512x512. , "" . ? ?

android.content.res.Resources, sPreloadedDrawables - . , - key sPreloadedDrawables, .

, :

  • ?

  • ?

. - , , - . , Holo.Light Holo.Dark ICS. - : ? ?

+5
3

android.jar, . . - 0x000000 0x272d33, - 0xe8e8e8 0xfafafa. android.jar/res/drawable-nodpi/background_holo_dark.png background_holo_light.png. , Android SDK.

0

, , . , .

0

Zygote.

ZygoteInit#preloadResources()

    /**
 * Load in commonly used resources, so they can be shared across
 * processes.
 *
 * These tend to be a few Kbytes, but are frequently in the 20-40K
 * range, and occasionally even larger.
 */
private static void preloadResources() {
    final VMRuntime runtime = VMRuntime.getRuntime();

    try {
        mResources = Resources.getSystem();
        mResources.startPreloading();
        if (PRELOAD_RESOURCES) {
            Log.i(TAG, "Preloading resources...");

            long startTime = SystemClock.uptimeMillis();
            TypedArray ar = mResources.obtainTypedArray(
                    com.android.internal.R.array.preloaded_drawables);
            int N = preloadDrawables(runtime, ar);
            ar.recycle();
            Log.i(TAG, "...preloaded " + N + " resources in "
                    + (SystemClock.uptimeMillis()-startTime) + "ms.");


            startTime = SystemClock.uptimeMillis();
            ar = mResources.obtainTypedArray(
                    com.android.internal.R.array.preloaded_color_state_lists);
            N = preloadColorStateLists(runtime, ar);
            ar.recycle();
            Log.i(TAG, "...preloaded " + N + " resources in "
                    + (SystemClock.uptimeMillis()-startTime) + "ms.");
        }
        mResources.finishPreloading();
    } catch (RuntimeException e) {
        Log.w(TAG, "Failure preloading resources", e);
    }
}

, com.android.internal.R.array.preloaded_drawables

0

All Articles