summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Hans Boehm <hboehm@google.com> 2022-10-07 00:47:01 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2022-10-07 00:47:01 +0000
commit3d794a3a66c27fb0fceddceadcba807e8a675288 (patch)
tree634037288e71172a57ca6ac98c32f9f5f54f64dd
parent81182b0d98633046606ea13470bfa3244737f550 (diff)
parent87376c8b475996f3b627bb692d1230476457303b (diff)
Merge "Make LoadClass collect garbage as promised" am: e16473b1da am: 87376c8b47
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2150615 Change-Id: I9ce4b3b580841daf2be9f2df8a6412049ba15c11 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--tools/preload/loadclass/LoadClass.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/preload/loadclass/LoadClass.java b/tools/preload/loadclass/LoadClass.java
index a71b6a8b145e..3f6658ab8c65 100644
--- a/tools/preload/loadclass/LoadClass.java
+++ b/tools/preload/loadclass/LoadClass.java
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import android.util.Log;
import android.os.Debug;
+import android.util.Log;
/**
* Loads a class, runs the garbage collector, and prints showmap output.
@@ -28,7 +28,7 @@ class LoadClass {
System.loadLibrary("android_runtime");
if (registerNatives() < 0) {
- throw new RuntimeException("Error registering natives.");
+ throw new RuntimeException("Error registering natives.");
}
Debug.startAllocCounting();
@@ -46,7 +46,7 @@ class LoadClass {
}
}
- System.gc();
+ Runtime.getRuntime().gc();
int allocCount = Debug.getGlobalAllocCount();
int allocSize = Debug.getGlobalAllocSize();
@@ -73,7 +73,7 @@ class LoadClass {
response.append(',').append(freedCount);
response.append(',').append(freedSize);
response.append(',').append(nativeHeapSize);
-
+
System.out.println(response.toString());
}