Questions tagged [jcmd]

jcmd utility is used to send diagnostic command requests to a running Java Virtual Machine (JVM). Like when you need stack trace, heap dump, vm arguments, system properties etc.

Below are official links for more details on jcmd

https://docs.oracle.com/javase/8/docs/technotes/tools/windows/jcmd.html https://docs.oracle.com/javase/9/tools/jcmd.htm

48 questions
10
votes
1 answer

why there is difference in Heap dump size generated by jmap and jcmd?

I am trying to take heap dump using below 2 commands jcmd $pid GC.heap_dump /tmp/filename.dump jmap -dump:format=b,file=/tmp/filename.dump $pid jcmd produces file size of ~300M and jmap produces file size of ~1.4G. why these are different sizes,…
Vipin
  • 4,851
  • 3
  • 35
  • 65
9
votes
1 answer

What is contained in code/internal sections of JCMD?

Dimensioning a docker container for a JVM based service is tricky (as we all know). I'm pretty sure we have slightly under-dimensioned a container and want to clear up a few questions I have relating to specific jcmd (Native Memory Tracker) outputs…
Ronan B
  • 123
  • 5
7
votes
3 answers

Where is the heap dump file created by jcmd?

I have tried to take a heap dump using jcmd (from a git bash console window): $ /c/Program\ Files/Java/jdk1.8.0_202/bin/jcmd 25156 GC.heap_dump filename=livetest-grindtohalt.hprof 25156: Heap dump file created However, the file does not seem to…
Robin Green
  • 32,079
  • 16
  • 104
  • 187
6
votes
4 answers

Monitoring java native memory

We are monitoring jvm metrics like heap, metaspace, threads and gc count and we are able to push these metrics to monitorng server like prometheus. Similarly we wanted to track Java native memory metrics(output of jcmd VM.sumary). My question is,…
Uday Shankar
  • 141
  • 2
  • 10
6
votes
2 answers

jcmd VM.set_flag, which flags are writable?

I was trying to experiment with jcmd VM.set_flag option. But came across one error saying "only 'writeable' flags can be set". What are writable flags ? Getting my pid: XXX@XXX-Air:~/javacode$ jcmd -l 6294 Test 6295 jdk.jcmd/sun.tools.jcmd.JCmd…
Vipin
  • 4,851
  • 3
  • 35
  • 65
5
votes
1 answer

jstat and jcmd giving different answers for metaspace memory

I'm currently investigating a compressed class space issue. I know what the issue is, but while investigating, I noticed that jstat -gc ... and jcmd ... GC.heap_info give different numbers of metaspace and compressed class space capacity and…
Bryan Head
  • 12,360
  • 5
  • 32
  • 50
3
votes
0 answers

Java process memory usage deviation from jcmd committed memory

I'm seeing large variations in memory usage for a java process (running in docker), when compared to the memory usage as reported by jcmd which is tracking the JVM process. The JVM memory usage according to jcmd is quite stable but the memory usage…
Ronan B
  • 123
  • 5
3
votes
1 answer

jcmd - Meaning of last colum for `jcmd VM.flags -all`

Run following command to list all available jvm flags: jcmd 24468 VM.flags -all | less -N Then in last column, found following values (using JDK1.8, on linux): * product default value is the same on all platform, * pd product default value…
Eric
  • 22,183
  • 20
  • 145
  • 196
3
votes
3 answers

jcmd - What is command ManagementAgent.start used for?

When using jcmd to monitor java process, there is a command ManagementAgent.start. Checking man page / oracle document / google, didn't found any description. The question is: What is it used for?
Eric
  • 22,183
  • 20
  • 145
  • 196
2
votes
1 answer

How to create a class histogram of a JVM app from the very same JVM app?

I would like to diagnose some unexpected OOM errors using jmap or jcmd. Unfortunately, these tools are not easy to use in a CI pipeline, because I would have to launch the JVM app in the background, somehow get its PID, and then get the timing right…
Martin Drozdik
  • 12,742
  • 22
  • 81
  • 146
2
votes
0 answers

ps and jcmd VM.native_memory showing different results

I am getting out of memory issues while running docker container after a certain amount of time. I tried to investigate using jcmd 305 VM.native_memory to see what part of memory is causing this. It gives the following result, Native Memory…
user2206366
  • 461
  • 3
  • 6
  • 17
2
votes
1 answer

How to run JCMD without JDK on a docker container with openJDK installed

I need to run JCMD on prod to monitor my application, but unfortunately I can't have a proper JDK in place so I need to run it with a JRE. I can add some dependencies, but not the whole jdk. I'm using openJDK 8. Does anyone know how to do it? There…
Ivan Codo
  • 41
  • 4
2
votes
1 answer

Java Thread dump with JCMD

I am using Java1.8 in Ubuntu Linux machine. Created a thread dump with below command: jcmd 1670 Thread.print > Thread.jfr Copied File to local MAC machine and double clicked to open in JMC. It failed to open. HOw to open it? I tried to open same…
AKB
  • 5,918
  • 10
  • 53
  • 90
1
vote
0 answers

Why the heap Memory from NativeMemoryTracking and jstat is not Similar?

I have a program running in an ec2 Linux machine that uses Apache Arrow ( which makes use of Netty Direct Buffers). To track the memory footprint of the application, I have launched the application with -XX:NativeMemoryTracking=detail flag. However,…
Somesh Dhal
  • 336
  • 2
  • 15
1
vote
1 answer

Java Flight Recorder : How to set stack depth at runtime?

I cannot find a way to set JFR stack depth at runtime. I'm using OpenJDK 11. jcmd JFR.configure stackdepth=128 seems to have no effect. After executing the command I correctly see this message : D:\>jcmd 8848 JFR.configure…
Olivier Masseau
  • 778
  • 7
  • 23
1
2 3 4