File jol.pod of Package jol
=encoding utf8 =head1 NAME jol - tiny toolbox to analyze object layout in JVMs =head1 SYNOPSIS jol [I<mode>] [I<optional arguments>]* =head1 DESCRIPTION JOL (Java Object Layout) is the tiny toolbox to analyze object layout in JVMs. These tools are using Unsafe, JVMTI, and Serviceability Agent (SA) heavily to decode the actual object layout, footprint, and references. This makes JOL much more accurate than other tools relying on heap dumps, specification assumptions, etc. =head1 OPTIONS =head2 Available modes =over =item B<estimates> Simulate the class layout in different VM modes. =item B<externals> Show the object externals: the objects reachable from a given instance. This dives into the Object graphs layout: list objects reachable from the instance, their addresses, paths through the reachability graph, etc (is more convenient with API though). $ jol externals java.lang.String # Running 64-bit HotSpot VM. # Using compressed oop with 3-bit shift. # Using compressed klass with 3-bit shift. # Objects are 8 bytes aligned. # Field sizes by type: 4, 1, 1, 2, 2, 4, 4, 8, 8 [bytes] # Array element sizes: 4, 1, 1, 2, 2, 4, 4, 8, 8 [bytes] Instantiated the sample instance via default constructor. java.lang.String@64cee07d object externals: ADDRESS SIZE TYPE PATH VALUE 58010a600 16 [C .value [] 58010a610 8923824 (something else) (somewhere else) (something else) 58098d0c0 24 java.lang.String (object) Addresses are stable after 1 tries. =item B<footprint> Estimate the footprint of all objects reachable from a given instance. This gets the object footprint estimate, similar to the object externals, but tabulated. $ jol footprint java.lang.Thread # Running 64-bit HotSpot VM. # Using compressed oop with 3-bit shift. # Using compressed klass with 3-bit shift. # Objects are 8 bytes aligned. # Field sizes by type: 4, 1, 1, 2, 2, 4, 4, 8, 8 [bytes] # Array element sizes: 4, 1, 1, 2, 2, 4, 4, 8, 8 [bytes] Instantiated the sample instance via default constructor. java.lang.Thread@64cee07d footprint: COUNT AVG SUM DESCRIPTION 13 84 1104 [B 496 67 33400 [C 139 23 3272 [Ljava.lang.Class; 17 89 1520 [Ljava.lang.Object; ... 1 24 24 sun.reflect.generics.tree.ClassSignature 3 16 48 sun.reflect.generics.tree.ClassTypeSignature 2 24 48 sun.reflect.generics.tree.FormalTypeParameter 3 24 72 sun.reflect.generics.tree.SimpleClassTypeSignature 2849 200416 (total) =item B<heapdumpstats> Consume the heap dump and print the most frequent instances. =item B<internals> Show the object internals: field layout and default contents, object header. This dives into Object layout: field layout within the object, header information, field values, alignment/padding losses. $ jol internals java.util.HashMap # Running 64-bit HotSpot VM. # Using compressed oop with 3-bit shift. # Using compressed klass with 3-bit shift. # Objects are 8 bytes aligned. # Field sizes by type: 4, 1, 1, 2, 2, 4, 4, 8, 8 [bytes] # Array element sizes: 4, 1, 1, 2, 2, 4, 4, 8, 8 [bytes] Instantiated the sample instance via default constructor. java.util.HashMap object internals: OFF SZ TYPE DESCRIPTION VALUE 0 8 (object header: mark) 0x0000000000000005 (biasable; age: 0) 8 4 (object header: class) 0x00019828 12 4 java.util.Set AbstractMap.keySet null 16 4 java.util.Collection AbstractMap.values null 20 4 int HashMap.size 0 24 4 int HashMap.modCount 0 28 4 int HashMap.threshold 0 32 4 float HashMap.loadFactor 0.75 36 4 java.util.HashMap.Node[] HashMap.table null 40 4 java.util.Set HashMap.entrySet null 44 4 (object alignment gap) Instance size: 48 bytes Space losses: 0 bytes internal + 4 bytes external = 4 bytes total =item B<shapes> Dump the object shapes present in JAR files or heap dumps. =item B<string-compress> Consume the heap dumps and figures out the savings attainable with compressed strings. =back =head1 LICENSE Released under version 2.0 of the L<GPL license|https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.




