Dojo 1.7 Build: Memory Errors

After upgrading to Dojo 1.7.3, our ant build, which has worked flawlessly for many years in previous versions of Dojo, now completely fails due to memory errors:

[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 

I have documented our problems in detail here .

In particular, where I note:

If I run my assembly directly from the CL as a Java command, โ€œoptimize shrinksafe", it fails, but succeeds without it (running it only with internStrings seems to cause other errors).

Not sure what to do with this, as I consider oprtimize defaults to be shortened, but I have defined 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 \ build \ head \ assembly \ generated \ general \ comComplete.profile.js - release release --releaseDir C: \ company \ builds \ head \ build \ generated \ general \ htdocs \ company \ javascript \ 1420

BROKEN (due to 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 \ build \ head \ assembly \ generated \ general \ comComplete.profile.js - release 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 crash with a memory error:

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"> -> -> โ†’ ->


Update 1

I also tried:

 <jvmarg value="-Xms5120m"/> <jvmarg value="-Xmx5120m"/> 

And also using the maxmemory parameter of the java ant task itself.

+4
source share
1 answer

Finally, the problem found, the value of switchDir switch has both windows and unix file separators. This works well in Dojo <1.6, and usually Java has no problem with this. For some reason, the Dojo 1.7 build system hits memory problems in this case.

In releaseDir, after resolving the ant tokens from the question, it was mixed with unix and windows file separators:

 <arg value="releaseDir=${output.dir}/path/foo/bar" /> -> Became -> releaseDir=blah\blah\blah/path/foo/bar 

And that was enough to make the assembly block the "writing of resources", and then take it out of the heap. (This is what Java usually handles without problems).

The fix was simple enough:

 <path id="dojo.output.tmp"> <pathelement location=" ${output.dir}/path/foo/bar "/> </path> <pathconvert targetos="unix" property="dojo.output.dir" refid="dojo.output.tmp" /> ... <arg value="releaseDir=${dojo.output.dir}" /> 
+3
source

All Articles