Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 36eff60d authored by Tim Murray's avatar Tim Murray Committed by Android (Google) Code Review
Browse files

Merge changes from topic "malloc-purge-master"

* changes:
  hwui: purge malloc pages on bitmap destruction
  wm: recycle bitmaps immediately in TaskSnapshotPersister
parents 1b32aa09 e0b5e846
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -224,6 +224,7 @@ Bitmap::~Bitmap() {
            break;
        case PixelStorageType::Heap:
            free(mPixelStorage.heap.address);
            mallopt(M_PURGE, 0);
            break;
        case PixelStorageType::Hardware:
            auto buffer = mPixelStorage.hardware.buffer;
+4 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.server.wm;

import static android.graphics.Bitmap.CompressFormat.*;

import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;

@@ -361,6 +362,7 @@ class TaskSnapshotPersister {

            // For snapshots with reduced resolution, do not create or save full sized bitmaps
            if (mSnapshot.isReducedResolution()) {
                swBitmap.recycle();
                return true;
            }

@@ -373,6 +375,8 @@ class TaskSnapshotPersister {
                Slog.e(TAG, "Unable to open " + file + " for persisting.", e);
                return false;
            }
            reduced.recycle();
            swBitmap.recycle();
            return true;
        }
    }