Small info on Memory increase in java.
By using the command Xms and Xmx ,we can increase the java
memory .
The flag Xmx specifies the maximum memory allocation pool
for a Java Virtual Machine (JVM), while Xms specifies the initial memory
allocation pool.
This means that your JVM will be started with Xms amount of
memory and will be able to use a maximum of Xmx amount of memory. For example,
starting a JVM like below will start it with 256MB of memory, and will allow
the process to use up to 2048MB of memory:
java -Xmx2048m -Xms256m
The memory flag can also be specified in multiple sizes,
such as kilobytes, megabytes, and so on.
-Xmx1024k
-Xmx512m
-Xmx8g
The Xms flag has no default value, and Xmx typically has a
default value of 256MB. A common use for these flags is when you encounter a
java.lang.OutOfMemoryError.
To aovoid "java.lang.OutOfMemoryError: PermGen space”
error,have to use "-XX:MaxPermSize=256m" .
*Here k-KB,m-MB,g-GB
*If we are using any IDE(Netbean or Eclipse) then have to
add in VM optios for core application.
*For Web application have to add stanalone.conf(Wildfly
server bin folder) and catlina.sh or catlina.bat (tomcat bin folder) like below
:
JAVA_OPTS="-Xms64m -Xmx512m -XX:MaxPermSize=256m
No comments:
Post a Comment