A few days ago, when the server of a project in the company broke down, it was replaced by a backup server, but it went down after a while. java. Lang. outofmemoryerror was reported all the time .... As soon as we can see it, we can see that the memory overflows, but the JBoss memory configuration has reached MB, and the JBoss memory monitoring results are not very high. How can we crash? It's strange. After half a day, there was no result. Depressed ~~~~
At the end of the day, I was desperate to change to a JBoss version and another JDK to see if it was a problem. But before changing the log, I read the log again and found a problem. The reported java. Lang. outofmemoryerror is followed by Java. Lang. outofmemoryerror: permgen space, which seems to be different from Java. Lang. outofmemoryerror: Java heap space. Finally, I found this exception!
Permgen space stands for permanent generation space, which is the permanent storage area of the memory. This part is used to store class and meta information. When the class is loaded, it is placed in the permgen space area. Unlike the heap area where the instance is stored, GC (garbage collection) is not stored in the masterProgramPermgen space is cleaned up during runtime. Therefore, if your app loads many classes, the permgen space error may occur. This error is common when the web server pre-compile the JSP. Correction Method:-xms512m-xmx1024m-XX: maxnewsize = 256 m-XX: maxpermsize = 256 m Because many jar packages are referenced in the project, the class information in these jar packages will be loaded to the permgen space area by JBoss Class Loader. By default, the size of this part of space is only 4 MB. In the case of many jar packages, it is obviously not enough. Therefore, you can solve the problem by specifying the maximum value through-XX: maxpermsize = 256 m. My JBoss contains 6 applications, and the jar package and class are about mb. With this parameter, everything is OK. After the server is repaired, I found that, this is also the way JBoss is configured ~~ It seems that it is best to back up the data in the future together with JBoss!
When an exception occurs in Java. Lang. outofmemoryerror: Java heap space, you can solve this problem by adjusting-xms512m-xmx1024m.
In addition, the two parameters-XX: + useparallelgc-XX: + useparalleloldgc allow the Service to recycle memory space in parallel. However, these two parameters also occupy a certain amount of memory space after being configured.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service