提供更多的JVM堆空间
我在Jruby和Rails上。我正在尝试预编译我的资产,但它给我以下错误。
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)
我在搜索此错误时在stakoveflow上找到的下面命令,但仍然不起作用。
rake assets:precompile RAILS_ENV=production EXECJS_RUNTIME='Node' JRUBY_OPTS="-J-d32 -X-C"
我认为这个问题是因为plotly-lastest.min.js文件。该文件的大小为1724KB。每当我从应用程序中删除此文件时。
仅用于信息,我的Jruby版本1.7.16,Rails版本为4.2.0如何克服这个问题?
只要为预编译任务(jruby -J-Xmx1g ...
)