在升级到Dojo 1.7.3后,我们之前版本的Dojo上运行良好的ant构建现在完全无法操作,因为出现了内存溢出错误:
[java] starting writing resources...
[java] java.lang.OutOfMemoryError: GC overhead limit exceeded
[java] at org.mozilla.javascript.Interpreter.getArgsArray(Interpreter.java:4623)
[java] at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3335)
[java] at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484)
[java] at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
[java] at org.mozilla.javascript.NativeArray.iterativeMethod(NativeArray.java:1565)
[java] at org.mozilla.javascript.NativeArray.execIdCall(NativeArray.java:313)
[java] at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:127)
[java] at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3335)
[java] at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484)
[java] at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
[java] at org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2347)
[java] at org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:272)
[java] at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:127)
[java] at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76)
[java] at org.mozilla.javascript.gen.c1._c62(Unknown Source)
[java] at org.mozilla.javascript.gen.c1.call(Unknown Source)
[java] at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)
[java] at org.mozilla.javascript.gen.c1._c69(Unknown Source)
[java] at org.mozilla.javascript.gen.c1.call(Unknown Source)
[java] at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)
[java] at org.mozilla.javascript.gen.c1._c40(Unknown Source)
[java] at org.mozilla.javascript.gen.c1.call(Unknown Source)
[java] at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)
[java] at org.mozilla.javascript.gen.c1._c42(Unknown Source)
[java] at org.mozilla.javascript.gen.c1.call(Unknown Source)
[java] at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3335)
[java] at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484)
[java] at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
[java] at org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2347)
[java] at org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:272)
[java] at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:127)
[java] at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76)
[java] js: exception from uncaught JavaScript throw: java.lang.OutOfMemoryError: GC overhead limit exceeded
我在这里广泛记录了我们的问题。
特别是,我注意到:
If I run my build straight from the CL as a Java command, with the ' --optimize shrinksafe" switch, it fails, but without it succeeds. (running it with internStrings alone seems to cause other errors).
Not sure what to make of this, since I believe that oprtimize defaults to shrinksafe, but I have determined the following:
WORKS:
c:\temp\dojo-release-1.7.3rc1-src\util\buildscripts>java -Xms256m -Xmx256m -cp ../shrinksafe/js.jar;../closureCompiler/compiler.jar;../shrinksafe/shrinksafe.jar org.mozilla.javascript.tools.shell.Main ../../dojo/dojo.js baseUrl=../../dojo load=build -p C:\company\builds\head\build\generated\general\comComplete.profile.js --action release --releaseDir C:\company\builds\head\build\generated\general\htdocs\company\javascript\1420
BROKEN (out of memory errors):
c:\temp\dojo-release-1.7.3rc1-src\util\buildscripts>java -Xms256m -Xmx256m -cp ../shrinksafe/js.jar;../closureCompiler/compiler.jar;../shrinksafe/shrinksafe.jar org.mozilla.javascript.tools.shell.Main ../../dojo/dojo.js baseUrl=../../dojo load=build -p C:\company\builds\head\build\generated\general\comComplete.profile.js --action release --releaseDir C:\company\builds\head\build\generated\general\htdocs\company\javascript\1420 --optimize shrinksafe --internStrings true
Unfortunately, the following ant script target continues to fail with memory errors:
BuildNum: ${buildNum}
<path id="js.path"> <pathelement location="${basedir}"/> </path> <pathconvert targetos="unix" property="js.path.unix" refid="js.path"
/> js.path.unix: ${js.path.unix}
<!-- clean unpack and output dirs --> <delete
dir="${outputDir}/htdocs/company/javascript/src/" />
<copy file="${externalDir}/dojo/companyComplete.profile.js"
tofile="${outputDir}/companyComplete.profile.js" filtering="yes" overwrite="yes">
<java fork="true" dir="${outputDir}/htdocs/company/javascript/src/util/buildscripts" classname="org.mozilla.javascript.tools.shell.Main"
failonerror="true"> --> --> --> -->
更新 1
我还尝试了以下内容:
<jvmarg value="-Xms5120m"/>
<jvmarg value="-Xmx5120m"/>
同时,也可以在ant java任务本身上使用maxmemory
设置。
js: exception from uncaught JavaScript throw: java.lang.OutOfMemoryError: Java heap space
。 - mtyson