measuring object size in Java
Siddharth Jain
siddhsql at gmail.com
Thu Sep 28 01:14:22 UTC 2023
Hello,
I am using this method to measure object size in Java:
https://stackoverflow.com/a/52682/147530
and it was (it still does) working with JDK17 on a x64 Intel based Mac. But
today I tried it with JDK20 on a AARch64 based Mac and it does not work. I
get runtime exception:
https://stackoverflow.com/questions/77055455/java-lang-nullpointerexception-cannot-invoke-java-lang-instrument-instrumentat/77055526#77055526
java.lang.NullPointerException: Cannot invoke
"java.lang.instrument.Instrumentation.getObjectSize(Object)" because
"com.github.jelmerk.ObjectSizeFetcher.instrumentation" is null
at com.github.jelmerk.ObjectSizeFetcher.getObjectSize
(ObjectSizeFetcher.java:18)
at com.mycompany.app.App.main (App.java:48)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:279)
at java.lang.Thread.run (Thread.java:1623)
any idea how I can fix this? thanks,
S.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/jdk-dev/attachments/20230927/9f39a7df/attachment.htm>
More information about the jdk-dev
mailing list