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:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user