Ant Ivy:堆内存不足:超出GC开销限制

时间:2014-01-17 21:08:49

标签: java memory ant garbage-collection

我有一个ant项目,并且成功构建。但是当我尝试运行我的PageRank程序时:etc / run.sh SequentialPageRank -input inputDirectory -output rankScore.txt -jump 0.15。终端返回错误:

Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded
at java.util.Arrays.copyOf(Arrays.java:2367)
at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:130)
at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:114)
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:480)
at java.lang.StringBuffer.append(StringBuffer.java:309)
at java.util.regex.Matcher.appendReplacement(Matcher.java:839)
at java.util.regex.Matcher.replaceAll(Matcher.java:906)
at java.lang.String.replaceAll(String.java:2162)
at edu.umd.cloud9.example.pagerank.SequentialPageRank.main(SequentialPageRank.java:123).

据我估计,SequentialPageRank程序需要大约5G-10G内存。我在一个总共120G内存的远程超级服务器上运行这个程序。所以记忆应该足够了。我用谷歌搜索,发现这是由于内存堆大小。因此,我尝试了三种不同的解决方案:

1. export ANT_OPTS="-Xmx10000m", run this command in terminal and rebuilt by enter "ant" command.
2. Modify build.xml. 
<target name="compile" depends="init,resolve" description="compile the source ">
   <javac encoding="UTF-8" classpathref="lib.path.id" srcdir="${src.dir}/dist" destdir="${build.dir}" optimize="on" debug="on">
       <compilerarg line="-J-Xms128m -J-Xmx10000m -Xlint:unchecked" />
   </javac>
</target>
3. Modify build.xml like 2. But I modified javac option fork="true", which will fork a new JVM instead of using default ant JVM.

然而,上述3种解决方案均未奏效。我确信上面3个修改都正确运行,例如,我输入echo $ ANT_OPTS并显示“-Xms128m -Xmx10000m”。我不知道如何解决这个问题,有谁知道解决方案?非常感谢!

1 个答案:

答案 0 :(得分:0)

尝试指定此JVM选项-XX:+UseConcMarkSweepGC