Use WeakReference for the TaskSnapshotWindow in inner Window.
Use WeakReference for the TaskSnapshotWindow so it can be clear at GC. Also clear the TaskSnapshotWindow reference in mStartingWindowRecords since it should be removed immediately. Still observer the native Binder reference could hold the reference to the TaskSnapshotWindow$Window object, from the local test it can be released after force GC(need to trigger on system_server and systemUI). So at least with this patch, TaskSnapshotWindow object can be released immediately. Bug: 225363815 Test: open several tasksnapshot starting window, verify the memory can be released on perfetto. Test: atest TaskSnapshotWindowTest StartingSurfaceDrawerTests Change-Id: Iaa0a266c2c6756cef24d92cde57a6debc947e133
Loading
Please register or sign in to comment