Is an alternative to JMap available?

When I ran below the jmap command:

jmap -histo 14104 

I can see a very good output of my objects, instances used bytes are used there.

  num #instances #bytes class name ---------------------------------------------- 1: 1308333 398374280 [C 2: 55058 84410136 [B 3: 1548041 49537312 java.lang.ref.Finalizer 4: 1584594 38030256 java.util.HashMap$Entry 5: 1327543 31861032 java.lang.String 6: 765682 25734336 [Ljava.lang.Object; 

But unfortunately, this is not supported by Oracle and is not available on the latest Windows and Linux JDK distributions. Can someone please help suggest an alternative to jmap?

+5
source share
3 answers

First of all, jmap works for me on Windows 10 and JDK 1.8.0_192 after setting all permissions for the %TMP%\hsperfdata_<username> directory.

Secondly, you can use the VisualVM tool VisualVM :

VisualVM in Memory Sampler Mode

It has a Sampler utility that allows you to check the heap histogram.

If you do not see your Java process in the left list, try using the -Dcom.sun.management.jmxremote property.

0
source

jmap -histo works for Oracle JDK at least for now. You can also use Jconsole not for the same, but very descriptive information. You can use Jhat for the information you see above, and a lot of other information in the browser.

0
source

But unfortunately, this is not supported by Oracle and is not available on the latest Windows and Linux JDK distributions.

This is incorrect information.

I am running Fedora 29 with OpenJDK Java 11 installed, and jmap is definitely present:

 $ ls -l /usr/bin/jmap .... /usr/bin/jmap -> /etc/alternatives/jmap $ ls -l /etc/alternatives/jmap .... /etc/alternatives/jmap -> /usr/lib/jvm/java-11-openjdk-11.0.4.11-0.fc29.x86_64/bin/jmap 

OpenJDK Java 11 is available for Fedora (current versions), CentOS 7 & 8, RHEL 7 & 8, Ubuntu 16.04 & 18.04, Debian 9 ... and many others.

And for Oracle distributions, I see the jmap in the Oracle Java 12 SE documentation:

therefore, we can assume that this tool will be present when installing the Oracle JDK distribution.

0
source

All Articles