Cause analysis of Java program memory overflow

This paper analyzes the causes of Java program memory overflow in detail. Share with you for your reference. The details are as follows:

Encountered an online system message Java Lang. outofmemoryerror: permgen space error. You need to locate the problem. I got this a long time ago. I really don't remember it now, but it's really an interesting question, which is worth studying. First, of course, the first reaction is to add the - XX: + printgcdetails parameter to see the specific GC log. However, since the program is started by tomcat, I'm worried that there are too many things encapsulated in it and it's difficult to locate. Since it's under windows, I'd better use the visualization tool. Then let's take a look at the cause of this error, find an explanation on the Internet, which is very good. Post it and borrow it:) the full name of permgen space is permanent generation space, which refers to the permanent storage area of memory. This memory is mainly used by the JVM to store class and meta information. When class is loaded, it will be put into permgen space, It is different from the heap area where class instances are stored. GC (garbage collection) will not clean up the permgen space during the running of the main program. Therefore, if there is a class in your application, the permgen space error is likely to occur. This error is common when the web server pre compiles JSPS. If a large number of third-party jars are used under your web app, and their size exceeds the JVM default size (4m), this error message will be generated. Let's first increase the initial memory size of permgen:

Catalina.com under Linux Add at the beginning of the SH file:

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>