Solving PermGem Errors with the Integrated WLS in JDeveloper

One bug that we are aware of in JDeveloper 11g is that there is a memory leak if you do many repeat runs of an application.

However there is an easy way to eliminate most of those by changing the a setting in the specs for the integrated server.

Locate the file: setDomainEnv.cmd which should be at:
[JDev Install Dir]\jdeveloper\system\system11.\DefaultDomain\bin

There find the line:
set MEM_MAX_PERM_SIZE=-XX:MaxPermSize=128m
and change it to:
set MEM_MAX_PERM_SIZE=-XX:MaxPermSize=512m

Now try and run your projects again.


And, of course, on Unix/Linux, the file to edit is

Posted by John Stegeman on March 04, 2009 at 05:07 PM PST #

Hi! I have external WLS server and I'm deploying my applications to that external server. And it happens there too. After three or maybe four deployments I get PermGen Error. Server settings are JAVA Memory arguments: -Xms256m -Xmx512m -XX:CompileThreshold=8000 -XX:PermSize=48m -XX:MaxPermSize=128m . WLS Start Mode=Development I will change this, I just wanted to say that maybe this error is not JDevelopers deployment process issue. ADF on! Janez

Posted by jlavric on March 04, 2009 at 09:54 PM PST #

Shay thanks for this - it solved my problem - it was getting very annoying but this setting seems to have done the trick. Darragh

Posted by Darragh Duffy on March 06, 2009 at 10:01 PM PST #

I used such settings before, but it seems the solution for me was to clean "drs" directory if application runs to slow or cached previous deployment. MEM_MAX_PERM_SIZE=-XX:MaxPermSize=512m i think is to much for Perm memmory - even for big applications. Probably the problem is not in this settings.

Posted by Pavel on March 08, 2009 at 05:34 PM PDT #

drs directory is the deployment dir of weblogic and has NOTHING to do with mem. You clean drs to remove old redeployments. 512MB might be too much but this is cos weblogic has a mem leak. So eventually you will run out of mem. So, the > the permsize the > the time you get with no out of mem error. Savvy? PS: Yes the problem is in the mem leak if that is what you mean, but untill then that is a damn good workaround.

Posted by Jerome on March 09, 2009 at 11:27 PM PDT #

It got better when configuring these settings, but I still get PermGen error after like 10 runs of my application. Before I configured WLS, it happened about every 3rd time I run the app. Anything else I could do to get rid of this completely? thanks

Posted by Andre on March 10, 2009 at 04:53 PM PDT #

There is a limitation on the total mem that a java app can have under windows 32bit. This is something from the net: Win32 (Win2K, XP, 2K3): roughly 1300m (+/- 100m) Linux (2.6 kernels): safe upto about 2500m; higher if you dare Solaris 8 and 9: ~ 3000m (but you can push it up to 3500m sometimes) ( In order to use 512MB as perm mem, you cannot increase xmx much more than 768MB. So far I tested perm mem = 256MB and xmx=1024, and when I got perm mem out of exception, the mem used by java process of weblogic was 621MB. Conclusively, I think that there is a trade off between max perm mem and max xmx. I am using perm mem=512MB & xmx=768MB now and so far everything's OK

Posted by spido on March 10, 2009 at 06:01 PM PDT #

Shay, perhaps you should consider pointing out that if users deploy to a WLS instance that is running the JRockit JVM, then PermGen errors do not happen at all as it's garbarge collection mechanisms are different than Sun's. James

Posted by guest on March 19, 2009 at 09:25 PM PDT #

@James, I actually just posted about this on the JDeveloper forums and showed an approach for how to set up your development environment to use JRockit for running the integrated WLS: John

Posted by John Stegeman on March 30, 2009 at 08:39 PM PDT #

Thanks for all of you, This solved the perm Gen space memory problem

Posted by Ahmed Elhamy on March 31, 2009 at 05:45 PM PDT #

As far as we 're talking about mem problems, you know this but also here as some trivial solutions until oracle fixs this bug

Posted by spido on June 11, 2009 at 05:18 PM PDT #

And this is how is done in WLS 10.3.1

Posted by spido on July 08, 2009 at 09:38 PM PDT #

Hi Shay,

I am getting some "Java.Lang.Outofmemoryerror: Alloclargeobjectorarray". How can I solve this. Please provide your inputs on this I am totally stuck over here. I am running JDEV with JROCKIT jdk1.6 and Weblogic server 10.3.6


Posted by Ravi on April 30, 2012 at 12:24 AM PDT #

Ravi - you should be asking this on the JDeveloper discussion forum on OTN. And please provide more information on when do you get this. Is it with every application? Is it when you do a specific operation in the application?

Posted by Shay on April 30, 2012 at 10:27 AM PDT #

I don't have this file. I have a "commEnv.cmd" but changing some parameters there it doesn't avoid the problem. Anyway in the launching message I don't see the parameters I specified so it mustn't be that.
Are in the same files? (everything changes a lot from version to version, that's shitty)
You say this problem raises with repeated launching of projects. It happens to me on the first launch, why can it be? :(

Posted by guest on July 17, 2013 at 08:51 AM PDT #

guest - you are not looking at the right location - the file is still there in JDev

Posted by guest on July 17, 2013 at 12:51 PM PDT #

I am experiencing this problem with 12.1.2 version. Is this still bug?

Posted by rade on December 24, 2013 at 11:24 AM PST #

You should be able to apply the same settings in 12c.
That being said, in 12c we support hot-deployment so in most cases you can just hit Save All, Rebuild All, and then just reload the page in your browser without the need to re-run/re-deploy your application.

Posted by Shay on December 26, 2013 at 09:30 AM PST #

If simply editing the values in still doesn't work, i figured another USER_MEM_ARGS env-variable is being set in commEnv. In the view, this variable can be observed by doing a printenv | grep USER_MEM_ARGS.
To prevent this Env-variable from taking effect, in find the statement which sets the MEM_ARGS env-variable. In my this statement is:

Comments this line and try the usual setting Run/Debug/Profiles for project or editing parameters in directly.

Posted by guest on May 21, 2014 at 03:38 AM PDT #

Thanks Pavel.
Deleting the "drs" folder helped in my case as well.

Posted by Bhask on May 20, 2015 at 02:41 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed

I'm a Director of Product Management for Oracle's Cloud Development Tools and Frameworks.
Follow me:

« June 2016