diff options
| author | 2024-01-08 11:10:18 -0800 | |
|---|---|---|
| committer | 2024-01-08 11:13:47 -0800 | |
| commit | acb46e4ce68e3308ef00f70982fc018ccbb02a5a (patch) | |
| tree | 4fd5308ac727de434e08180fe5c8f8731db35e67 | |
| parent | f3a6dcf1d78c1dda2ffdee42e644ac73c0e9f46a (diff) | |
Release VintfObject memory after compat check at boot time.
After compatibility check at boot time, the VintfObject is
usually no longer needed. Hence, at boot time, we actively
release the VintfObject object after compatibility check
by not using the shared instance in the first place.
Test: TH
Bug: 270169217
Change-Id: I9b3383cd52fa67eb18dd5837f96caf2b0eab2ce5
| -rw-r--r-- | core/jni/android_os_VintfObject.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/jni/android_os_VintfObject.cpp b/core/jni/android_os_VintfObject.cpp index b6517117ca62..a5b2f65eafc7 100644 --- a/core/jni/android_os_VintfObject.cpp +++ b/core/jni/android_os_VintfObject.cpp @@ -96,8 +96,11 @@ static jobjectArray android_os_VintfObject_report(JNIEnv* env, jclass) static jint android_os_VintfObject_verifyBuildAtBoot(JNIEnv* env, jclass) { std::string error; + // Use temporary VintfObject, not the shared instance, to release memory + // after check. int32_t status = - VintfObject::GetInstance() + VintfObject::Builder() + .build() ->checkCompatibility(&error, ENABLE_ALL_CHECKS.disableAvb().disableKernel()); if (status) LOG(WARNING) << "VintfObject.verifyBuildAtBoot() returns " << status << ": " << error; |