Question: Jruby Rails: Java::JavaLang::OutOfMemoryError: Java heap space error while compiling assets

Question

Jruby Rails: Java::JavaLang::OutOfMemoryError: Java heap space error while compiling assets

Answers 1
Added at 2016-12-07 15:12
Tags
Question

I am on jruby and rails. i am trying to precompile my assets but its giving me below error.

rake aborted!
Java::JavaLang::OutOfMemoryError: Java heap space
org.mozilla.javascript.ScriptableObject.createSlot(org/mozilla/javascript/ScriptableObject.java:2913)
org.mozilla.javascript.ScriptableObject.getSlot(org/mozilla/javascript/ScriptableObject.java:2841)
org.mozilla.javascript.ScriptableObject.putImpl(org/mozilla/javascript/ScriptableObject.java:2725)
org.mozilla.javascript.ScriptableObject.put(org/mozilla/javascript/ScriptableObject.java:515)
org.mozilla.javascript.IdScriptableObject.put(org/mozilla/javascript/IdScriptableObject.java:386)
org.mozilla.javascript.ScriptableObject.putProperty(org/mozilla/javascript/ScriptableObject.java:2432)
org.mozilla.javascript.ScriptRuntime.setObjectProp(org/mozilla/javascript/ScriptRuntime.java:1665)
org.mozilla.javascript.ScriptRuntime.setObjectProp(org/mozilla/javascript/ScriptRuntime.java:1659)
org.mozilla.javascript.Interpreter.interpretLoop(org/mozilla/javascript/Interpreter.java:1250)
org.mozilla.javascript.Interpreter.interpret(org/mozilla/javascript/Interpreter.java:815)
org.mozilla.javascript.InterpretedFunction.call(org/mozilla/javascript/InterpretedFunction.java:109)
org.mozilla.javascript.ContextFactory.doTopCall(org/mozilla/javascript/ContextFactory.java:393)
org.mozilla.javascript.ScriptRuntime.doTopCall(org/mozilla/javascript/ScriptRuntime.java:3280)
org.mozilla.javascript.InterpretedFunction.call(org/mozilla/javascript/InterpretedFunction.java:107)
RUBY.call(C:/jruby-1.7.16/lib/ruby/gems/shared/gems/therubyrhino-2.0.4/lib/rhino/rhino_ext.rb:193)
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)

i have tried below command that i found on stakoveflow while searching for this error but still its not working.

rake assets:precompile RAILS_ENV=production EXECJS_RUNTIME='Node' JRUBY_OPTS="-J-d32 -X-C"

I think this problem is juste because of plotly-latest.min.js file . The size of this file is 1724KB . whenever i remove this file from application.js my assets precompilation works properly.

Just for info my jruby version 1.7.16 and rails version is 4.2.0 How to overcome this problem?

Answers
nr: #1 dodano: 2016-12-09 12:12

just give it more JVM heap space for the precompile task (jruby -J-Xmx1g ...)

Source Show
◀ Wstecz