开发者社区> 长烟慢慢> 正文
阿里云
为了无法计算的价值
打开APP
阿里云APP内打开

Java.Lang.OutOfMemoryError 错误——设置java Heap Size

简介: 1、确定当前系统可以设置的最大值: Below command will help you to identify the maximum memory heap size than can be allocated to a JVM process.
+关注继续查看

1、确定当前系统可以设置的最大值:

Below command will help you to identify the maximum memory heap size than can be allocated to a JVM process.

java -mx[value]m -version

Start with a higher value like 4G or higher and slowly cut down to the maximum allowed value.

举例:

$ java -mx4096m -version

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

$ java -mx4096m -version
[ERROR] Specified maximum heap size (4GB) is larger than the address space on this platform (4 GB).
Could not create the Java virtual machine.

从上面就知道本系统支持不了4g的大小。


Now lets reduce to a lesser value, viz., 3Gig

$ java -mx3072m -version
java version “1.5.0.04″
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0.04-_27_jul_2006_10_52)
Java HotSpot(TM) Server VM (build 1.5.0.04 jinteg:07.27.06-16:18 IA64, mixed mode)

现在可以知道,3g大小是可以支持的。


2、设置java Heap大小的步骤:

First, you need to identify how much is the maximum heap size that you can set. Click here.

Once you had identified the maximum heap size, we need to change the configuration files to make it
permanent.

Step 1: Edit opmn.xml file.

Location : $INST_TOP/ora/10.1.3/opmn/conf/

Open opmn.xml

Search for string Xms or Xmx or module-id=”OC4J”

This search should lead you to below location

‘<’process-type id=”oacore” module-id=”OC4J” status=”enabled” working-dir=”$ORACLE_HOME/j2ee/home”‘>’
‘<’category id=”start-parameters”‘>’
‘<’data id=”java-options” value=”-server -verbose:gc -Xmx512M -Xms128M ……]

The default value for Maximum (-Xmx) and Minimum (-Xms) heap sizes are 512M and 128M respectively.

Again here you have options, you can set both Xms and Xmx has the same value as Xmx if you feel all your sessoins require higher memory or set a lower value for Xms and the maximum value for Xmx. Dont forget to change the values under ‘<’category id=”stop-parameters”‘>’

opmn.xml also contains jvm configurations for other components – oafm & forms.

Step 2: Edit oc4j.properties file.

Location : ($INST_TOP/ora/10.1.3/j2ee/oacore/config)

This step is optional since we had already made changes in opmn.xml but there is no harm in making the change here. This step will come handy for troubleshooting specific components of Oracle viz., configurator, iSupplier or any other option which heavily utilizes/consumes CPU/memory.

Search for string Xms or Xmx or wrapper.

Option 1: If you find any of the above parameters change the values corresponding to the value you had  mentioned in opmn.xml or even more than that, as long as you dont exceed the maximum heap size limit.

Option 2: If you DO NOT find any of the above parameters, then make an entry like this, under the heading “# Java Object Cache Configuration Parameters”

wrapper.bin.parameters=-Xms[Value]M -Xmx[Value]M -XX:NewSize=256M -XX:MaxNewSize=256M

Step 3: Edit Applications Context file

vi $CONTEXT_FILE

Location: $INST_TOP/appl/admin/SID_hostname.xml

search for string s_oacore_jvm_start_options

Change Xms and Xmx value. Repeat the same step for parameter s_oacore_jvm_stop_options.

Changes made in Step 3 will take effect the next time you run autoconfig, whereas Step 1 & 2 changes will take effect the next time you bounce opmn services, but the values are not permanent in the sense these will be wiped off next time you run autoconfig. Yes you can preserve the changes by placing it inbetween Begin and End customizations.

You can also increase the Garbage Collection threads parameter (-XX:ParallelGCThreads) to a higher value if you have JDK 1.5 or more than 2 cpus or more memory. For more information on this you can refer to Metalink Note: 362851 – Guidelines to setup the JVM in Apps Ebusiness Suite 11i and R12.

cheers,
oraclePitStop.


版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

相关文章
Java——HashMap键值排序
Java——HashMap键值排序
42 0
Java - 基础 - HashMap
Java - 基础 - HashMap
43 0
SAP Java GUI integration log
SAP Java GUI integration log
42 0
HIBT全球安全顶会|阿里云安全最新Java研究分享
日前阿里云安全团队受邀参加欧洲顶级信息安全会议HACK IN THE BOX(HITB),并以《Make JDBC Attack Brilliant Again 》为主题发表演讲。
101 0
Java基础篇:多态
多态就是指一个类实例的相同方法在不同情形有不同表现形式,在面向对象设计的概念中,对于父类提供的方法调用,子类可以有自己特有的行为。
113 0
Java HashMap 默认排序
先看一段Java代码。 package com.m58.test; import java.text.ParseException; import java.text.SimpleDateFormat; import java.
1002 0
java hashmap
引用:http://alex09.iteye.com/blog/539545   HashMap 和 HashSet 是 Java Collection Framework 的两个重要成员,其中 HashMap 是 Map 接口的常用实现类,HashSet 是 Set 接口的常用实现类。
960 0
java中的Heap 和 Stack
  1. 栈(stack)与堆(heap)都是Java用来在Ram中存放数据的地方。与C++不同,Java自动管理栈和堆,程序员不能直接地设置栈或堆。
561 0
+关注
长烟慢慢
系统架构师
814
文章
0
问答
文章排行榜
最热
最新
相关电子书
更多
低代码开发师(初级)实战教程
立即下载
阿里巴巴DevOps 最佳实践手册
立即下载
冬季实战营第三期:MySQL数据库进阶实战
立即下载