我正在运行一个 ruby on rails 应用
轨道 3.1.3 ruby 1.9.3p0
我正在尝试让我的数据库运行,但在运行 rake db:migrate 时出现 fatal error
rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
[FATAL] failed to allocate memory
而且我在运行 rails s 时也得到了它
rails s
=> Booting WEBrick
=> Rails 3.1.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[FATAL] failed to allocate memory
通过 --trace 我明白了
rails s --trace
/Users/developer/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/commands/server.rb:33:in `parse!': invalid option: --trace (OptionParser::InvalidOption)
from /Users/developer/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rack-1.3.5/lib/rack/server.rb:280:in `parse_options'
from /Users/developer/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rack-1.3.5/lib/rack/server.rb:180:in `options'
from /Users/developer/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/commands/server.rb:54:in `set_environment'
from /Users/developer/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/commands/server.rb:42:in `initialize'
from /Users/developer/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/commands.rb:49:in `new'
from /Users/developer/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/commands.rb:49:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
有什么线索吗?我做了一些搜索,然后 this looks to be the closest但是按照他们的方法切换 mysql 并没有帮助。
最佳答案
我的猜测是您需要移除“厨房水槽”。将 gem 列表缩减为仅应用程序正常运行所需的内容。否则考虑添加更多内存。
关于mysql - Rails 3.1 和 mysql [致命] 分配内存失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8441878/