summaryrefslogtreecommitdiff
path: root/libs/androidfw/ResourceTimer.cpp
diff options
context:
space:
mode:
author Hani Kazmi <hanikazmi@google.com> 2022-06-08 13:53:42 +0000
committer Hani Kazmi <hanikazmi@google.com> 2022-06-14 09:10:53 +0000
commit2685de9862657b0e0ac3593aa3f351e1b42dc01e (patch)
treece87a2e2a764f9f1247dfb40721a73359a77236b /libs/androidfw/ResourceTimer.cpp
parentd7a3e60763530b31c6758e156ec5f0716ca7104f (diff)
BaseBundle.java: Recycle underlying parcel when bundle is cleared.
Lazy Bundles, (aosp/1787847), introduced a change in behavior where a Parcel created as part of initializing a Bundle is dependent on the next ART GC run to be recycled, causing a short term memory-leak. To land this in T, we are making the change targetted and allowing consumers to opt into the parcel being immediately cleared by calling .clear() on the bundle. As part of the unparcel() in clear(), mParcelledData is set to null, and mMap may or may not still contain references through lazy values, depending on if the lazy valyes have been unmarshalled. As such, we keep a weak reference to mParcelledData we can use to recycle it. The mParcelledData reference could have been copied to other bundles in a few operations: new Bundle(Bundle o) bundle.deepCopy() bundle.putAll() In this case we can not recycle the parcel yet as other bundles may still require it. If so, we will skip the recycle and rely on the later GC pass Bug: 233216232 Test: Reproduced linked bug on-device Test: atest android.os.cts.ParcelTest android.os.cts.BundleTest android.os.BundleTest android.os.ParcelTest Change-Id: Ic26eceaa1c11da67866af0963f760423d41d54bc
Diffstat (limited to 'libs/androidfw/ResourceTimer.cpp')
0 files changed, 0 insertions, 0 deletions