In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Today Xiaobian to share with you about Tomcat memory overflow and memory setting method is what the relevant knowledge, detailed content, clear logic, I believe that most people still know too much about this knowledge, so share this article for your reference, I hope you will learn something after reading this article, let's take a look at it.
There are different types of memory in java, different types of memory overflows, and different processing methods, so be sure to see what kind of exception it is. Memory overflow exceptions are usually encountered in the following two ways:
Java.lang.OutOfMemoryError: PermGen space
Java.lang.OutOfMemoryError: Java heap space
PermGen space
PermGen space memory overflows are the most common. The full name is Permanent Generation space, which refers to the permanent storage area of memory. JDK8 abolishes PermGen space to avoid this type of memory overflow and does not need to set this item. If you encounter this kind of memory overflow, it is recommended to upgrade to JDK8, or set Perm memory.
Recommended values for memory settings for Jspxcms:
-minimum XX:PermSize=128M:Perm memory.
-maximum XX:MaxPermSize=512M:Perm memory.
Java heap space
Java heap space is a heap memory overflow. If you encounter such a memory overflow, you need to increase the heap memory.
Recommended values for memory settings for Jspxcms:
-minimum Xms256M:Heap memory.
-maximum Xmx512M:Heap memory. Those with plenty of memory can be configured as-Xmx1024M
Java memory type
There are two types of java memory: Heap and Non-heap.
Heap memory. It is used to store the data generated at run time, such as objects, arrays, and so on. When heap memory is almost full, garbage collection is started, freeing up memory space. If the Heap memory is not set, the default is 1x4 of the physical memory. Nowadays, the capacity of memory strips is getting larger and larger, and there are relatively few cases of heap memory overflows. When heap memory overflows, the error message is: java.lang.OutOfMemoryError: Java heap space.
Non-Non-heap memory. It's PermGen. The space used to store classes. The default is 1 stroke 64 of physical memory. At the beginning of java design, the scale of various programs was relatively small, there were not many java classes, and the number of runtime classes was fixed, so the space was very small by default and there was no garbage collection. With the rapid development of java, a variety of class libraries are gradually increasing, java programs are becoming larger and larger, the number of classes is expanding rapidly, and the default non-heap memory space is more and more insufficient. Especially with the wide application of reflection mechanism and dynamic proxy technology, programs can create classes at run time, which makes PermGen memory overflow more common. When a non-heap memory overflow occurs, the error message is: java.lang.OutOfMemoryError: PermGen space.
The designers of Java also saw this problem, abolishing PermGen in jdk8 and garbage collecting the space where the class information is stored. So when you encounter a java.lang.OutOfMemoryError: PermGen space exception, the best way is to upgrade to jdk8.
Memory Settin
The setting methods are different in different software, different versions and different situations. For example, the memory of eclipse is set in the eclipse.ini file under the eclipse directory.
Tomcat decompressed version of Windows platform
Modify {TOMCAT_HOME} / bin/catalina.bat to insert the following configuration in the second line (that is, after the first line @ echo off):
Set JAVA_OPTS=-Xms256m-Xmx512m-XX:PermSize=128m-XX:MaxPermSize=512mTomcat decompressed Linux platform
Modify TOMCAT_HOME/bin/catalina.sh by inserting the following configuration in the second line (that is, after the first line #! / bin/sh):
JAVA_OPTS='-Xms256m-Xmx512m-XX:PermSize=128m-XX:MaxPermSize=512m'Tomcat installation
The installation version needs to be set up in the control panel. -XX:PermSize=128m-XX:MaxPermSize=512m is set in Java Options, and-Xms256m-Xmx512m corresponds to Initial memory pool and Maximum memory pool, respectively.
WebLogic
Modify {ORACLE_HOME} / user_projects/domains/base_domain/bin/setDomainEnv.sh (.cmd in windows environment)
WLS_MEM_ARGS_64BIT= "- Xms512m-Xmx1024m" export WLS_MEM_ARGS_64BITWLS_MEM_ARGS_32BIT= "- Xms512m-Xmx1024m" export WLS_MEM_ARGS_32BITif ["${JAVA_VENDOR}"! = "HP"]; then if ["${VM_TYPE}" = "HotSpot"] Start Tomcat using Maven in then WLS_MEM_ARGS_64BIT= "- Xms256m-Xmx1024m" export WLS_MEM_ARGS_64BIT WLS_MEM_ARGS_32BIT= "- Xms256m-Xmx1024m" export WLS_MEM_ARGS_32BIT fifiEclipse
Starting Tomcat using tomcat6:run or tomcat7:run in Eclipse needs to be set in the Run Configurations-JRE-VM arguments option.
These are all the contents of this article entitled "what is the method of Tomcat memory overflow and memory setting". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.