Java. Lang. outofmemoryerror: permgen space solving Tomcat outofmemoryerror: heap space and permgen s

Source: Internet
Author: User
Solving Tomcat outofmemoryerror: heap space and permgen spacetomcat March 12th, 2009

It's quite common to run inMemory problemsWhen running some big Java EE application on a Tomcat server.
Some of the most commmon errors are like the following ones.

This is about a fullHeap Space:

 
Severe: servlet. Service () for servlet JSP threw exceptionjava. Lang. outofmemoryerror: Java heap Space

This other is aboutPermgen SpaceThat's a memory area, where compiled classes (andJSPs) Are kept, and this error might happen often if the running web application have happens. Java and. jsp.

 
Memoryerror: permgen spacejava. Lang. outofmemoryerror: permgen Space

To increase the memory available to Tomcat, aboutHeapAndPermgenThe correct options are the following ones.

This sets the maxHeapAvailable to Tomcat at 1 GB of memory:

 
-- Jvmmx 1024

This sets the maxPermgenAvailable to Tomcat at 256 MB of memory:

 
-XX: maxpermsize = 256 m

To change the Tomcat memory settings (when Tomcat is installed on WindowsSystem Service), It's required to use the command-line toolTomcat6. The next command changes the memory settings for the Tomcat service namedTomcat6

 
Tomcat6 // us // tomcat6 -- jvmmx 1024 + + jvmoptions = "-XX: maxpermsize = 256 m"

The label// Us // tomcat6Has the meaningUPdatingSErver parameters for the service namedTomcat6.
Obviusly this command shocould be executed from the directoryC:/program files/Apache Software Foundation/tomcat 6.0/binOr from wherever isBinDirectory of your tomcat installation. Or to make things simple, that directoy shocould be added to yourPathEnvironment variable.

It's even possible to update memory settings from a GUI frontend, or to view what happened after running the command line tool. Running the following command:

 
Tomcat6w // es // tomcat6

A window will open showing all the parameters about the Windows ServiceTomcat6.

It's possible to see in this image that, after running the previous command, for setting higher memory limits, in the sectionsMaximum Memory PoolAnd at the end ofJava optionsThe new memory limits are set.

Tomcat memory settings on Windows

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.