jol-cli and external class path

Bernd Eckenfels ecki at zusammenkunft.net
Thu May 14 05:02:30 UTC 2015


Am Wed, 13 May 2015 15:21:51 +0300
schrieb Aleksey Shipilev <aleksey.shipilev at oracle.com>:

> Yes, this is it:
>  https://bugs.openjdk.java.net/browse/CODETOOLS-7901419
>  http://hg.openjdk.java.net/code-tools/jol/rev/23eb6c92ad4e
> 
> Bernd, can you build JOL from source and tell if that covers your
> scenarios? General review is also appreciated. If everything is fine,
> we can arrange the 0.3.3 release with this on-board.

Thanks for the quick fix. I compiled 0.4-SNAPSHOT (49:1ae450a74f19) in
Maven 3.2.5 / Java 8 / Win64 cleanly.

It also works as advertised, I can add relativ or absolute directories
or JAR files to the external -cp, and it can inspect classes from the
external CP as well as internal (as well as [C syntax). This is better to use.
(the jol-cli.jar is not names jol-cli-full.jar, is that expected?)


I intuitively used "java -jar jol-cli.jar -cp ... internals test.Test"
first. From the help and source it is clear that it does not work and I
guess it is acceptable. (On the other hand, conceptionally -cp would be
a "global" option, independend of the mode?

An unknown mode (-cp) should maybe also show the Usage: help in
addition to the mode list:

Currently:

$ java -jar jol-cli\target\jol-cli.jar -cp ..
Available modes:
             estimates: Simulate the class layout in different VM modes.
             externals: Show the object externals: the objects reachable from a given instance.
             footprint: Estimate the footprint of all objects reachable from a given instance
              heapdump: Consume the heap dump and estimate the savings in different layout strategies.
             idealpack: Compute the object footprint under different field layout strategies.
             internals: Show the object internals: field layout and default contents, object header
       string-compress: Consume the heap dumps and figures out the savings attainable with compressed strings.
Unknown mode: -cp

Better(?):

$ java -jar jol-cli\target\jol-cli.jar -cp ..\..\\asf\test\target\classes
Usage: jol-cli.jar <mode> [optional arguments]*

Available modes:
             estimates: Simulate the class layout in different VM modes.
             externals: Show the object externals: the objects reachable from a given instance.
             footprint: Estimate the footprint of all objects reachable from a given instance
              heapdump: Consume the heap dump and estimate the savings in different layout strategies.
             idealpack: Compute the object footprint under different field layout strategies.
             internals: Show the object internals: field layout and default contents, object header
       string-compress: Consume the heap dumps and figures out the savings attainable with compressed strings.
Unknown mode: -cp

Gruss
Bernd


More information about the jol-dev mailing list