Happens intermittently on all platforms. The stacktrace:
Java HotSpot(TM) 64-Bit Server VM warning: CodeHeap 'non-profiled nmethods' is full. Compiler has been disabled.
Java HotSpot(TM) 64-Bit Server VM warning: Try increasing the code heap size using -XX:NonProfiledCodeHeapSize=
java.lang.NullPointerException: Cannot invoke "java.lang.management.MemoryPoolMXBean.getUsage()" because "<local1>" is null
at compiler.codecache.MHIntrinsicAllocFailureTest.fillCodeCacheSegment(MHIntrinsicAllocFailureTest.java:61)
at compiler.codecache.MHIntrinsicAllocFailureTest.main(MHIntrinsicAllocFailureTest.java:71)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:125)
at java.base/java.lang.Thread.run(Thread.java:1623)
Slightly modified code snippet:
// type is a BlobType.MethodProfiled
MemoryPoolMXBean bean = type.getMemoryPool();
int size = (int) (bean.getUsage().getMax() >> 7);
No usage object initialised for the said MemoryPool?