It’s quite common to run In memory problems when 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 full Heap space:
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.OutOfMemoryError: Java heap space
This other is about the PermGen space that’s a memory area, where compiled classes (and JSPs
) are kept, and this error might happen often if the running web application have many .java and .jsp.
MemoryError: PermGen space
java.lang.OutOfMemoryError: PermGen space
To increase the memory available to Tomcat, about heap and permgen the correct options are the following ones.
This sets the max heap available to Tomcat at 1Gb of memory:
--JvmMx 1024
This sets the max permgen available to Tomcat at 256Mb of memory:
-XX:MaxPermSize=256m
To change the Tomcat memory settings (when Tomcat is installed on Windows as system service), it’s required to use the command-line tool tomcat6
. The next command changes the memory settings for the Tomcat service named Tomcat6
tomcat6 //US//Tomcat6 --JvmMx 1024 ++JvmOptions="-XX:MaxPermSize=256m"
The label //US//Tomcat6
has the meaning of Updating Server parameters for the service named Tomcat6.
Obviously this command should be executed from the directory C:/Program Files/Apache Software Foundation/Tomcat 6.0/bin
or from wherever is the bin
directory of your Tomcat installation. Or to make things simple, that directoy should be added to your PATH
environment 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 service Tomcat6.
It’s possible to see in this image that, after running the previous command, for setting higher memory limits, in the sections Maximum memory pool and at the end of the Java Options the new memory limits are set.

Tomcat Memory Settings on Windows
相关推荐
java.lang.OutOfMemoryError: PermGen space 解决方案
在Java应用程序运行过程中,"java.lang.OutOfMemoryError: PermGen space"错误是常见的一个问题,尤其是在使用Tomcat这样的Java应用服务器时。这个错误表明应用程序在 PermGen 区域(Permanent Generation)耗尽了...
### Java.lang.OutOfMemoryError: PermGen space 及其解决方法 #### 一、PermGen space 概述 在Java虚拟机(JVM)中,PermGen space(永久代)是用于存储类的信息、常量、静态变量等数据的区域。在Java 8之前,Perm...
"Java.lang.OutOfMemoryError: Java heap space 解决方法" Java.lang.OutOfMemoryError: Java heap space 是 Java 中的一个常见错误,它发生时,Java 虚拟机 (JVM) 无法分配对象,因为堆空间不足。下面是解决该问题...
### Java 错误处理:java.lang.OutOfMemoryError: Java heap space 在Java应用程序开发过程中,经常遇到的一个问题就是内存溢出错误,特别是在处理大量数据或长时间运行的应用时。其中,“java.lang....
Eclipse 中通过 Tomcat 运行 J2EE 项目 java.lang.OutOfMemoryError PermGen space 的解决方案 在 Eclipse 中通过 Tomcat 运行 J2EE 项目时,可能会出现 java.lang.OutOfMemoryError: PermGen space 异常,这是由于...
在Java编程中,我们常常会遇到一个让人头疼的问题,那就是“java.lang.OutOfMemoryError: PermGen space”错误。这个错误提示表明,应用程序在运行过程中,内存的永久代(Permanent Generation)空间不足,导致了...
本文将针对两种常见的Java内存溢出错误——`java.lang.OutOfMemoryError: PermGen space`和`java.lang.OutOfMemoryError: Java heap space`进行详细的分析和解决方案的探讨。 首先,我们来看`java.lang....
tomcat内存溢出解决办法,错误信息:java.lang.OutOfMemoryError:PermGen space 参考该文档可快速解决内存溢出的问题,服务器:tomcat
### Myeclipse下java.lang.OutOfMemoryError: Java heap space的解决方案 在使用Myeclipse进行Java开发时,可能会遇到`java.lang.OutOfMemoryError: Java heap space`这个错误提示。这种异常通常发生在应用程序占用...
4. **调整PermGen空间**:在Java 8之前, PermGen 区域用于存储类的元数据,如果这个区域耗尽,会出现`java.lang.OutOfMemoryError: PermGen space`错误。在Java 8中,这部分被MetaSpace取代,可通过`-XX:...
根据提供的信息,这个错误主要涉及到两个方面:`PermGen space`和`Java heap`,并且与Tomcat服务器相关。 首先,让我们详细讨论`PermGen space`。 PermGen(Permanent Generation)是Java虚拟机(JVM)的一个内存...
在Java应用程序运行过程中,可能会遇到“OutOfMemoryError: PermGen space”的错误提示。这种错误通常发生在永久代(PermGen space)内存不足的情况下,永久代主要用于存储类的信息、常量、静态变量以及方法信息等。...
### 编译时出现java.lang.OutOfMemoryError Java heap space异常 #### 一、问题概述 在进行Java项目编译的过程中,可能会遇到`java.lang.OutOfMemoryError: Java heap space`这种异常。这类异常通常表明Java虚拟机...
在Java程序中,`java.lang.OutOfMemoryError: Java heap space` 是一个常见的错误,意味着程序在运行过程中耗尽了JVM分配的堆内存。这个错误通常发生在创建大量对象或者单个对象占用过多内存时。 一、问题描述与...
在Tomcat中java.lang.OutOfMemoryError: PermGen space异常处理: 1. PermGen space的全称是Permanent Generation space,是指内存的永久保存区域,这块内存主要是被JVM存放Class和Meta信息的。 2. Class在被Loader...
5. **增大PermGen或Metaspace大小**:如果你看到 `OutOfMemoryError: PermGen space` 或 `Metaspace`,这是方法区溢出,可以通过 `-XX:MaxPermSize` (对于老版本JVM) 或 `-XX:MaxMetaspaceSize` (对于Java 8及以后...
### Java.lang.OutOfMemoryError:Java Heap Space 错误及处理办法 在Java应用程序开发与维护过程中,经常会遇到`java.lang.OutOfMemoryError: Java heap space`这一异常情况。该异常通常表明Java虚拟机(JVM)的堆...