I installed Tomcat 8 with Java 8 on VPS server with 1024 RAM. But when I deploy war package I get error for memory.
I tried to limit the allocated memory with this setenv.sh script:
#! /bin/sh
export JAVA_OPTS="-Djava.awt.headless=true -server -Xms48m -Xmx1024M -XX:MaxPermSize=512m
But I get this error when I start Tomcat:
[root@ip-172-31-28-148 bin]# ./shutdown.sh
Using CATALINA_BASE: /opt/apache-tomcat-8.0.26
Using CATALINA_HOME: /opt/apache-tomcat-8.0.26
Using CATALINA_TMPDIR: /opt/apache-tomcat-8.0.26/temp
Using JRE_HOME: /
Using CLASSPATH: /opt/apache-tomcat-8.0.26/bin/bootstrap.jar:/opt/apache-tomcat-8.0.26/bin/tomcat-juli.jar
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0
[root@ip-172-31-28-148 bin]#
Do you have any idea what is the proper way to limit Java to use 512 MB RAM memory?
It's normal, the system property PermSize
and MaxPermSize
have been removed in Java8 and their use raise a warning.
You could use MaxMetaspaceSize
instead but your question is not clear. With PermSize, your reduce the memory allocated to the Permanent Generation, objects which are needed by the JVM and your container at all time.
If you want to reduce the memory used by your JVM (only the heap --> arrays and instances), you should use Xms (size at s tart) and Xmx (ma x size).
For example : -Xms256M -Xmx1024M
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.