From f3a9578910050d35fd536c1f9a7b5d629b3c19d8 Mon Sep 17 00:00:00 2001 From: Jun Su Date: Thu, 18 Jul 2013 17:43:26 +0800 Subject: Fix memory leak in ManageApplication ApplicationsAdapter new a Session member and make it has a reference to it self. If we don't release it explicitly, the cross reference will cause memory leak. Change-Id: Iecce35ae1d56d98cee6347e84d3a3ff57f3b15a5 --- src/com/android/settings/applications/ManageApplications.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/com/android/settings/applications/ManageApplications.java') diff --git a/src/com/android/settings/applications/ManageApplications.java b/src/com/android/settings/applications/ManageApplications.java index 0a1dcb11e..8b4be0141 100644 --- a/src/com/android/settings/applications/ManageApplications.java +++ b/src/com/android/settings/applications/ManageApplications.java @@ -321,6 +321,12 @@ public class ManageApplications extends Fragment implements } } + public void release() { + if (mApplications != null) { + mApplications.release(); + } + } + void updateStorageUsage() { // Make sure a callback didn't come at an inopportune time. if (mOwner.getActivity() == null) return; @@ -593,6 +599,10 @@ public class ManageApplications extends Fragment implements } } + public void release() { + mSession.release(); + } + public void rebuild(int sort) { if (sort == mLastSortMode) { return; @@ -990,6 +1000,7 @@ public class ManageApplications extends Fragment implements // are no longer attached to their view hierarchy. for (int i=0; i