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

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

Merge changes from topic "malloc-purge" into pi-dev

* changes:
  wm: recycle bitmaps immediately in TaskSnapshotPersister
  hwui: purge malloc pages on bitmap destruction
parents 688358e8 9b4eaf74
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -223,6 +223,7 @@ Bitmap::~Bitmap() {
            break;
        case PixelStorageType::Heap:
            free(mPixelStorage.heap.address);
            mallopt(M_PURGE, 0);
            break;
        case PixelStorageType::Hardware:
            auto buffer = mPixelStorage.hardware.buffer;
@@ -230,7 +231,6 @@ Bitmap::~Bitmap() {
            mPixelStorage.hardware.buffer = nullptr;
            break;
    }

    android::uirenderer::renderthread::RenderProxy::onBitmapDestroyed(getStableID());
}

+3 −0
Original line number Diff line number Diff line
@@ -360,6 +360,7 @@ class TaskSnapshotPersister {

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

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