Make sure VMClassLoader is initialized before eating up the RAM
Otherwise there may be an OOME when trying to resolve the class. When
this happens, it causes an abort in WrapExceptionInInitializer since
the class is in the bootstrap classloader.
Test: test-art-host
Bug: 69149957
Change-Id: I3cb79e8cffef758799d8c57ca5132d65a10e75ea
diff --git a/test/163-app-image-methods/src/Main.java b/test/163-app-image-methods/src/Main.java
index a995bb8..c513470 100644
--- a/test/163-app-image-methods/src/Main.java
+++ b/test/163-app-image-methods/src/Main.java
@@ -22,6 +22,9 @@
// Allocate memory for the "AAA.Derived" class name before eating memory.
String aaaDerivedName = "AAA.Derived";
System.out.println("Eating all memory.");
+ // Resolve VMClassLoader before eating all the memory since we can not fail
+ // initializtaion of boot classpath classes.
+ Class.forName("java.lang.VMClassLoader");
Object memory = eatAllMemory();
// This test assumes that Derived is not yet resolved. In some configurations