Saturday, 8 August 2015

Changing Heap Space, Perm Gen Space for ADF Applications

Hi All,
This is a short blog explaining on how to quickly get rid of Out of Memory errors while running application.

There are times when your application fails with the Out of Memory Heap Space error or Perm Space error. This can get quite annoying as you will have to do JDev restart. One can increase the size in the setDomainEnv.cmd file which can be found under following directory:

C:\Users\<user-name>\AppData\Roaming\JDeveloper\system12.1.2.0.40.66.68\DefaultDomain\bin

Or just type %AppData% from the Start icon will take you to Roaming folder.

Open file setDomainEnv.cmd in Notepad
and modify like the line below in bold

@REM IF USER_MEM_ARGS the environment variable is set, use it to override ALL MEM_ARGS values

set USER_MEM_ARGS=-Xms2048m -Xmx2048m -XX:PermSize=2048m -XX:MaxPermSize=2048m

if NOT "%USER_MEM_ARGS%"=="" (
set MEM_ARGS=%USER_MEM_ARGS%
)

Once you are done with your changes it should look like below. In my case the applications that I run is pretty huge so I prefer the 2GB of Heap Space and Perm Gen space each. You can set this according to your needs and memory availability.



So, how does one verify whats the actual value set in the JVM. It simple, when you run any application the Memory arguments are printed in the console as below:


Enjoy Learning!!