publicstaticvoid main(String[] args) throws Exception { Class<?> c = Class.forName("java.lang.StringFactory");
Method m = c.getDeclaredMethod("newStringFromBytes", byte[].class, int.class);
// Loop over allocations to get more chances of doing GC while in the // newStringFromBytes intrinsic. for (int i = 0; i < 10; i++) { try { byte[] f = newbyte[100000000];
f[0] = (byte)i;
f[1] = (byte)i;
m.invoke(null, f, 0);
} catch (InvocationTargetException e) { if (e.getCause() instanceof OutOfMemoryError) { // Ignore, this is a stress test.
} else { throw e;
}
} catch (OutOfMemoryError e) { // Ignore, this is a stress test.
}
}
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.13 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.