Tuesday, February 7, 2012

How to increase heap size in 32 bit machine OC4J Container?

java.lang.OutOfMemoryError occurs after complete utilization of heap memory.

In 32bit machine you can increase the heap approximately to 2GB. This also varies depending on various parameters like the size of RAM, Operating System etc.,

Generally in Windows machine half the RAM capacity will be used by the System and remaining by the applications. Configuration can be changed to reduce the system memory usage in Windows machine.

How to determine the maximum heap that can be allocated for your JVM?

Use the command "java -mx2048m -version", if your JVM supports given memory size you will get the JDK version message otherwise you will receive Invalid maximum heap size message.

$ java -mx3072m -version
java version "1.6.0.06"
Java(TM) SE Runtime Environment (build 1.6.0.06-jinteg_20_jan_2010_05_50-b00)
Java HotSpot(TM) Server VM (build 14.3-b01-jre1.6.0.06-rc1, mixed mode)


$ java -mx4096m -version
Invalid maximum heap size: -Xmx4096m
The specified size exceeds the maximum representable size.
Could not create the Java virtual machine.


How to change the heap size in OC4J container?

Take a backup of opmn.xml and edit the opmn.xml at location $ORACLE_HOME/opmn/conf.

Edit the startParameters of your container and add "-ms3072M -mx3072M" in value of 'java-options' to increase the heap size to 3GB

<category id="start-parameters">
<data id="java-options" value="-server -ms3072M -mx3072M -XX:MaxPermSize=512M -XX:AppendRatio=3 -Djava.security.policy=$ORACLE_HOME/j2ee/oc4j_soa/config/java2.policy -Djava.awt.headless=true -Dhttp.webdir.enable=false -Doraesb.home=$ORACLE_HOME/integration/esb -Dhttp.proxySet=false -Doc4j.userThreads=true -Doracle.mdb.fastUndeploy=60 -Doc4j.formauth.redirect=t
rue -Djava.net.preferIPv4Stack=true -Dorabpel.home=$ORACLE_HOME/bpel -Xbootclasspath^/p:$ORACLE_HOME/bpel/lib/orabpel-boot.jar -Dhttp.proxySet=false -XX:MaxNewSize=614m -XX:NewSize=614m -XX:SurvivorRatio=6 -Daia.home=$AIA_HOME/AIA -Dbpel.delivery.operationNameCheck=true -Dbpel.dms=false" />
</category>

No comments:

Post a Comment