Shay Shmeltzer's Oracle Development Tools Tips

  • March 4, 2009

Solving PermGem Errors with the Integrated WLS in JDeveloper

Shay Shmeltzer
Director of Product Management - Oracle

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.

Join the discussion

Comments ( 20 )
  • John Stegeman Thursday, March 5, 2009
    And, of course, on Unix/Linux, the file to edit is setDomainEnv.sh
  • jlavric Thursday, March 5, 2009
    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!
  • Darragh Duffy Saturday, March 7, 2009
    Shay thanks for this - it solved my problem - it was getting very annoying but this setting seems to have done the trick.
  • Pavel Monday, March 9, 2009
    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.
  • Jerome Tuesday, March 10, 2009
    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.
    PS: Yes the problem is in the mem leak if that is what you mean, but untill then that is a damn good workaround.
  • Andre Tuesday, March 10, 2009
    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?
  • spido Wednesday, March 11, 2009
    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
  • guest Friday, March 20, 2009
    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.
  • John Stegeman Tuesday, March 31, 2009
    @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: http://forums.oracle.com/forums/thread.jspa?threadID=879103
  • Ahmed Elhamy Wednesday, April 1, 2009
    Thanks for all of you, This solved the perm Gen space memory problem
  • spido Friday, June 12, 2009
    As far as we 're talking about mem problems, you know this
    also here as some trivial solutions until oracle fixs this bug
  • spido Thursday, July 9, 2009
    And this is how is done in WLS 10.3.1
  • Ravi Monday, April 30, 2012

    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



  • Shay Monday, April 30, 2012

    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?

  • guest Wednesday, July 17, 2013

    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? :(

  • guest Wednesday, July 17, 2013

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

  • rade Tuesday, December 24, 2013

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

  • Shay Thursday, December 26, 2013

    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.

  • guest Wednesday, May 21, 2014

    If simply editing the values in setDomainEnv.sh 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 setDomainEnv.sh find the statement which sets the MEM_ARGS env-variable. In my setDomainEnv.sh this statement is:


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

  • Bhask Wednesday, May 20, 2015

    Thanks Pavel.

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

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.