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

Skip to content
Commit 1b2bca67 authored by zhangshuai10's avatar zhangshuai10 Committed by Cherrypicker Worker
Browse files

Optimize the removal of garbage collected references to avoid memory leaks



mAllResourceReferences collects weak references to a resource when it is constructed, which is used to update the resource path of the library when loading webview. Currently, its garbage collected references(mAllResourceReferencesQueue) only cleaned up when ResourcesManager#redirectAllResourcesToNewImplLocked is executed, which means that if the application does not rely on webview, then cleanup cannot be performed.

Therefore, we need to clean up the mAllResourceReferencesQueue once when creating a new Resource and preparing to add its weak reference to mAllResourceReferences.

Bug: 363887630
Test: Create multiple new resources in app and observe mAllResourceReferencesQueue

Signed-off-by: default avatarzhangshuai10 <zhangshuai10@xiaomi.corp-partner.google.com>
(cherry picked from https://partner-android-review.googlesource.com/q/commit:d64e23dcff6acee2b8dd57a047389172fe95054e)
Merged-In: Ide10752f2dce86ff9b7d16335e625ae1919255f3
Change-Id: Ide10752f2dce86ff9b7d16335e625ae1919255f3
parent 53aebb03
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment