How to detect if the VM is running with compact refs from within the VM (no agent)?

Krystal Mok rednaxelafx at gmail.com
Wed Mar 14 01:41:13 PDT 2012


Hi Dawid,

I'm not aware of any way to get the exact "reference size" (or "oop size"
in HotSpot's terms). But it's possible to know whether compressed oops is
in use or not.

You could use HotSpotDiagnosticMXBean via JMX to get VM options. An example
here [1].

If you're trying to get this information from the command line, use:
  jinfo -flag UseCompressedOops *<pid>*

HTH,
- Kris

[1]:  https://gist.github.com/1333043

On Wed, Mar 14, 2012 at 4:30 PM, Dawid Weiss <dawid.weiss at gmail.com> wrote:

> Hi everyone,
>
> This has been asked on Apache Lucene JIRA and I admit I don't know the
> answer:
>
> Is there a way to detect the reference size (which boils down to
> compact vs. full reference on 64 bit machines) from within Java?
>
> I assume the VM starts without an agent so Instrumentation is not
> available. I'd appreciate a comment if somebody knows right away (even
> if it's a: "no"), otherwise I'll go through the sources and try to
> figure it out on my own.
>
> Thanks,
> Dawid
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20120314/04f8d127/attachment.html 


More information about the hotspot-compiler-dev mailing list