2010-04-29 36 views
0

我在Rails上使用AppEngine JRuby(SDK版本1.3.3.1) - 我經常遇到的一個問題是,經過幾次請求,服務器變得非常慢,直到它終止並在終端(OSX)上拋出OutOfMemoryError。AppEngine JRuby - OutOfMemoryError:Java堆空間 - 是否可以解決?

這些請求本身非常輕量級,不過比使用DataMapper尋找一個實體或保存實體。

在appspot上,這個問題沒有發生。

有什麼辦法可以擴大JRuby的堆空間嗎?

異常日誌:

Exception in thread "Timer-2" java.lang.OutOfMemoryError: Java heap space 
Apr 29, 2010 8:08:22 AM com.google.apphosting.utils.jetty.JettyLogger warn 
WARNING: Error for /users/close_users 
java.lang.OutOfMemoryError: Java heap space 
    at org.jruby.RubyHash.internalPut(RubyHash.java:480) 
    at org.jruby.RubyHash.internalPut(RubyHash.java:461) 
    at org.jruby.RubyHash.fastASet(RubyHash.java:837) 
    at org.jruby.RubyArray.makeHash(RubyArray.java:2998) 
    at org.jruby.RubyArray.makeHash(RubyArray.java:2992) 
    at org.jruby.RubyArray.op_diff(RubyArray.java:3103) 
    at org.jruby.RubyArray$i_method_1_0$RUBYINVOKER$op_diff.call(org/jruby/RubyArray$i_method_1_0$RUBYINVOKER$op_diff.gen) 
    at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:146) 
    at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57) 
    at org.jruby.ast.LocalAsgnNode.interpret(LocalAsgnNode.java:123) 
    at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) 
    at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) 
    at org.jruby.runtime.InterpretedBlock.evalBlockBody(InterpretedBlock.java:373) 
    at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:346) 
    at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:303) 
    at org.jruby.runtime.Block.yield(Block.java:194) 
    at org.jruby.RubyArray.collect(RubyArray.java:2354) 
    at org.jruby.RubyArray$i_method_0_0$RUBYFRAMEDINVOKER$collect.call(org/jruby/RubyArray$i_method_0_0$RUBYFRAMEDINVOKER$collect.gen) 
    at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:115) 
    at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:122) 
    at org.jruby.ast.CallNoArgBlockNode.interpret(CallNoArgBlockNode.java:64) 
    at org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:61) 
    at org.jruby.ast.LocalAsgnNode.interpret(LocalAsgnNode.java:123) 
    at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) 
    at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) 
    at org.jruby.ast.EnsureNode.interpret(EnsureNode.java:98) 
    at org.jruby.ast.BeginNode.interpret(BeginNode.java:83) 
    at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) 
    at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) 
    at org.jruby.ast.EnsureNode.interpret(EnsureNode.java:96) 
    at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:201) 
    at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:183) 

回答

-1

設置-XX:MaxHeapSize-Xmx VM參數

+0

謝謝,能否請您就如何做更具體的? – elado 2010-04-29 09:03:53

+0

好像好像dev_appserver.rb。 --jvm_flag = -Xmx1024m是解決方案。 – elado 2010-04-29 09:14:28

相關問題