This content has been marked as final. Show 3 replies
You can get a snapshot of the runtime's memory state yes. But to get the usage of a specific process is something you'd ask the operating system, this question has little to nothing to do with Java.1 person found this helpful
But still can't we grab the JVM usage using Java.
Maybe i'm not understanding your question, but if you are looking for how much memory the java process is using, you have the answer already (those lines of code in your original question). Those values are not the system memory size and usage, they are the jvm process memory allowance and usage.
if you want the system values, you can use this JMX mbean: