Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check memory utilization by java program?

Tags:

java

Is there any native java code to check the memory utilized by the program, or the only way possible is to check memory utilized by the JVM itlself?
can this be done purely in java or we need external process to fulfill this job?

like image 372
Space Rocker Avatar asked Mar 15 '26 10:03

Space Rocker


2 Answers

I think JConsole would be a good start.

like image 106
Art Licis Avatar answered Mar 16 '26 23:03

Art Licis


You could use java.lang.management.MemoryUsage, or the external tool, VisualVM (shipped with JDK).

like image 42
OrangeDog Avatar answered Mar 17 '26 01:03

OrangeDog



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!