Below
command prints the heap summary of java application.
jmap
-heap {PROCESS_ID}
For
example,
HelloWorld.javapublic class HelloWorld { public static void main(String args[]) throws Exception { int count = 0; Thread t1 = new Thread() { public void run() { while(true){ try{ Thread.sleep(2000); }catch(Exception e){ } } } }; t1.start(); } }
Compile
HelloWorld.java.
Launch
HelloWorld application using below command.
java -Xms128m -Xmx1024m -classpath . HelloWorld
Open
another command prompt (or) terminal and execute jcmd command.
C:\>jcmd 18612 5556 sun.tools.jcmd.JCmd 21292 HelloWorld
As
you see jcmd command output, HelloWorld application is running on port 21292.
C:\>jmap -heap 21292 Attaching to process ID 21292, please wait... Debugger attached successfully. Server compiler detected. JVM version is 25.171-b11 using thread-local object allocation. Parallel GC with 4 thread(s) Heap Configuration: MinHeapFreeRatio = 0 MaxHeapFreeRatio = 100 MaxHeapSize = 1073741824 (1024.0MB) NewSize = 44564480 (42.5MB) MaxNewSize = 357564416 (341.0MB) OldSize = 89653248 (85.5MB) NewRatio = 2 SurvivorRatio = 8 MetaspaceSize = 21807104 (20.796875MB) CompressedClassSpaceSize = 1073741824 (1024.0MB) MaxMetaspaceSize = 17592186044415 MB G1HeapRegionSize = 0 (0.0MB) Heap Usage: PS Young Generation Eden Space: capacity = 34078720 (32.5MB) used = 2045120 (1.95037841796875MB) free = 32033600 (30.54962158203125MB) 6.001164362980769% used From Space: capacity = 5242880 (5.0MB) used = 0 (0.0MB) free = 5242880 (5.0MB) 0.0% used To Space: capacity = 5242880 (5.0MB) used = 0 (0.0MB) free = 5242880 (5.0MB) 0.0% used PS Old Generation capacity = 89653248 (85.5MB) used = 0 (0.0MB) free = 89653248 (85.5MB) 0.0% used 735 interned Strings occupying 50584 bytes.
No comments:
Post a Comment