ART: Add forced garbage collection
Add ForceGarbageCollection support to the agent interface.
Add a test.
Test: m test-art-host-run-test-913-heaps
Bug: 32516268
Change-Id: Iaa97520d1b9e4b0adf088ccdf9712193c485b7c5
diff --git a/runtime/openjdkjvmti/heap.cc b/runtime/openjdkjvmti/heap.cc
index 1799e19..df33abd 100644
--- a/runtime/openjdkjvmti/heap.cc
+++ b/runtime/openjdkjvmti/heap.cc
@@ -210,4 +210,10 @@
return ERR(NONE);
}
+jvmtiError HeapUtil::ForceGarbageCollection(jvmtiEnv* env ATTRIBUTE_UNUSED) {
+ art::Runtime::Current()->GetHeap()->CollectGarbage(false);
+
+ return ERR(NONE);
+}
+
} // namespace openjdkjvmti