Merge changes from topic "malloc-purge-master"

* changes:
  hwui: purge malloc pages on bitmap destruction
  wm: recycle bitmaps immediately in TaskSnapshotPersister
This commit is contained in:
Tim Murray
2018-10-19 02:31:14 +00:00
committed by Android (Google) Code Review
2 changed files with 5 additions and 0 deletions

View File

@@ -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;

View File

@@ -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;
}
}