Useful Java flags and techniques
--------------------------------
FLAGS
-verbosegc : Outputs garbage collection information from the running JVM
-Xrunhprof : Provides runtime JVM statistics (heap, cpu, etc...)
example
-Xrunhprof:file=log.txt,thread=y,depth=3
syntax
-Xrunhprof[:help]|[:option=value,option2=value2, ...]
parameters
OptionName and Value Description Default
--------------------- ----------- -------
heap=dump|sites|all heap profiling all
cpu=samples|old CPU usage off
format=a|b ascii or binary output a
file=write data to file java.hprof
net=: send data over a socket write to file
depth=stack trace depth 4
cutoff=output cutoff point 0.0001
lineno=y|n line number in traces? y
thread=y|n thread in traces? n
doe=y|n dump on exit? y
--XX:ThreadStackSize=512 : Specify the size of stack for each new Java thread.
-XX:+AggressiveHeap : This option instructs the JVM to push memory use to the
limit: the overall heap is 3900MB, the new generation is 3072MB, the allocation area
of each thread is 256KB, and the collection policy defers as long as possible before
collecting.
-Xms3g -Xmx3g : Sets the heap minimum and maximum size to 3GB (use 'm' for megabytes)
-server : Use optimizing JIT compiler
-XX:+UseConcMarkSweepGC : Use concurrent garbage collector
-XX:+UseParallelGC : Use parallel garbage collector
-Xint : Interpret only, no JIT
-XX:+DisableExplicitGC : Disable calls to System.gc(), JVM still performs garbage collection when necessary
-m