publicstaticvoid main(String[] args) { // Stop the JIT to be sure nothing is running that could be resolving classes or causing // verification.
Main.stopJit();
Main.waitForCompilation();
// Make sure that there is no reclaimable memory in the heap. Otherwise we may throw // OOME to prevent GC thrashing, even if later allocations may succeed.
Runtime.getRuntime().gc();
System.runFinalization(); // NOTE: There is a GC invocation in the exhaustJavaHeap(). So we don't need one here.
int initial_size = 1024 * 1024; // Repeat to ensure there is no space left on the heap.
exhaustJavaHeap(initial_size);
exhaustJavaHeap(/*size*/ 4);
exhaustJavaHeap(/*size*/ 4);
try {
nullAccess(null);
storage.clear(); thrownew RuntimeException("Did not receive exception!");
} catch (OutOfMemoryError oome) {
storage.clear();
System.err.println("Received OOME");
} finally { // Even if it's an unexpected error, clear so that we can print things later.
storage.clear();
}
Main.startJit();
}
publicstaticint nullAccess(OOMEHelper nullInstance) { // Under AOT, this access is the first one to actually load the OOMEHelper class, so // we can pretty print the name and such. return nullInstance.nullField;
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.8 Sekunden
(vorverarbeitet am 2026-06-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.