On the basis of how we specify JVM option it can be
divided into two parts, JVM Options which starts with –X and those which starts
with -XX:
1)
JVM Options that begin
with -X are non-standard (thy are not guaranteed to be supported on
all JVM implementations), and are subject to change without notice in
subsequent releases of the JDK.
2)
JVM Options or
parameters which are specified with -XX are not stable and are
not recommended for casual use. These options are subject to change without
notice also.
-Xmx
The
flag Xmx specifies the
maximum memory allocation pool for a Java Virtual Machine (JVM), while Xms specifies the initial memory
allocation pool. A common use for these flags is when you encounter
a java.lang.OutOfMemoryError.
-Xms
set initial Java heap size
-Xmx
set maximum Java heap size
-Xss> set
java thread stack size
-XX:MaxPermSize
are used to set size for Permanent Generation.
Permanent Generation: The Permanent Generation is where class files are kept and never deallocated as the name suggests. These are the result of compiled classes and jsp pages. If this space is full, it triggers a Full Garbage Collection. If the Full Garbage Collection cannot clean out old unreferenced classes and there is no room left to expand the Permanent Space, an Out‐of‐ Memory error (OOME) is thrown and the JVM will crash
agentlib:jdwp
Sun's VM implementations require command line options to
load the JDWP agent for debugging.
From 5.0 onwards the -agentlib:jdwp option is used to load and specify options to the JDWP agent.
For releases prior to 5.0, the -Xdebug and -Xrunjdwp options are used
From 5.0 onwards the -agentlib:jdwp option is used to load and specify options to the JDWP agent.
For releases prior to 5.0, the -Xdebug and -Xrunjdwp options are used
The -agentlib:jdwp and -Xrunjdwp option can be further qualified with sub-options. The sub-options are specified as follows:
-agentlib:jdwp=<name1>[=<value1>],<name2>[=<value2>]...
or
-Xdebug
-Xrunjdwp:<name1>[=<value1>],<name2>[=<value2>]...
Transports
A JPDA Transport is a method of communication
between a debugger and the virtual machine that is being debugged (hereafter
the target VM). The communication is connection oriented - one side
acts as a server, listening for a connection. The other side acts as a client
and connects to the server. JPDA allows either the debugger application or the
target VM to act as the server.
- Socket Transport
The JPDA reference implementation provides a socket
transport for the Solaris, Linux, and Microsoft Windows platforms. The socket
transport uses a TCP/IP connection between the debugger application and the
target VM. With the socket transport, the debugger application and target VM
can reside either on the same machine or on different machines.
The socket transport is identified through a unique
string, dt_socket.
- Shared Memory Transport
In addition to the socket transport, the JPDA reference
implementation provides a shared memory transport on the Microsoft Windows
platform. The shared memory transport uses a shared memory region to exchange
JDWP packets between the debugger application and the target VM. With the
shared memory transport, the debugger application and target VM must reside on
the same machine.
The shared memory transport is identified through a unique
string, dt_shmem.
Server
The option server=y opens a socket and listens for
incoming debugger requests(cq acts as server).
With server=n the debugged application will try to
connect actively to a debugger and run therefore as a client.
Suspend
In JVM DEBUG parameters there is a parameter
called "suspend" which takes the value as "y" or
"n". so if you want to debug the process from the start set this
parameter as "suspend=y" and your Java application will wait
until Eclipse remotely connects to it. Otherwise, if you want to run your
program and later want eclipse to be connected that set this as "suspend=n"
so your java application will run normally and after eclipse remotely connected
to it, it will stop on breakpoints. (default
value suspend=y if not specified)
Source and References
http://javarevisited.blogspot.in/2011/11/hotspot-jvm-options-java-examples.html
Source and References
http://javarevisited.blogspot.in/2011/11/hotspot-jvm-options-java-examples.html
No comments:
Post a Comment