---
title: "Dealing with “java.lang.OutOfMemoryError: PermGen space” error"  
description: "Dealing with “java.lang.OutOfMemoryError: PermGen space” error"  
author: "Jayden Bell"  
published: 2015-05-07  
updated: 2015-05-07  
canonical: https://www.mindstick.com/forum/23199/dealing-with-java-lang-outofmemoryerror-permgen-space-error  
category: "java"  
tags: ["java"]  
reading_time: 1 minute  

---

# Dealing with “java.lang.OutOfMemoryError: PermGen space” error

Recently I ran into this [error](https://yourviews.mindstick.com/view/88527/fixing-quickbooks-error-4120-reinstalling-vs-repairing) in my [web application](https://www.mindstick.com/articles/13069/progressive-web-application-pwas-all-you-need-to-know-about):\
java.lang.OutOfMemoryError: PermGen [space](https://www.mindstick.com/articles/12954/do-your-electrical-repair-in-your-own-space)It's a typical [Hibernate](https://www.mindstick.com/blog/10963/introduction-to-hibernate-in-java)/JPA + IceFaces/[JSF](https://www.mindstick.com/forum/23342/what-are-jsf-servlet-and-jsp-and-what-is-difference-between-them) application running on Tomcat 6 and [JDK](https://www.mindstick.com/forum/33789/java_home-does-not-point-to-the-jdk) 1.6.\
Apparently this can occur after redeploying an application a few times.

## Replies

### Reply by Anonymous User

The solution was to add these flags to JVM command line when Tomcat is started:\

```
-XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
```

You can do that by shutting down the tomcat service, then going into the Tomcat/bin directory and running tomcat6w.exe. Under the "Java" tab, add the arguments to the "Java Options" box. Click "OK" and then restart the service.\
If you get an error the specified service does not exist as an installed service you should run:\

```
tomcat6w //ES//servicename
```

where servicename is the name of the server as viewed in services.msc


---

Original Source: https://www.mindstick.com/forum/23199/dealing-with-java-lang-outofmemoryerror-permgen-space-error

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
