RFR: 8314940: Use of NIO in JDKs Metrics implementation causes issues in GraalVM

Severin Gehwolf sgehwolf at openjdk.org
Thu Aug 24 14:42:28 UTC 2023


On Thu, 24 Aug 2023 13:37:36 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> Something fishy here, is this working around a bug in GraaVM native image or why does this change need to be in JDK?

I've now realized that the bug had an incorrect statement in the description. The cycle happens due to the `Runtime.getRuntime().maxMemory()` implementation in GraalVM to use JDK `Metrics`, since the `ByteBuffer` [code relies on the `Runtime.getRuntime().maxMemory()` API](https://github.com/openjdk/jdk/blob/76b9011c9ecb8c0c713a58d034f281ba70d65d4e/src/java.base/share/classes/jdk/internal/misc/VM.java#L261). The GraalVM impl to use the JDK Metrics seems a reasonable thing to do, no?

With that said, it's seems a rather uncontroversial change with very limited scope. Do you see anything problematic in this patch? Happy to revise if you think there are some no-no's :)

-------------

PR Comment: https://git.openjdk.org/jdk/pull/15416#issuecomment-1691812632


More information about the core-libs-dev mailing list