代码之家  ›  专栏  ›  技术社区  ›  tommy chheng

如何在Rails 3中启用内存和对象分析?

  •  4
  • tommy chheng  · 技术社区  · 14 年前

    我运行了rake test:profile,得到了一个报告:

        process_time: 62 ms
              memory: unsupported
             objects: unsupported
    

    我使用的是ruby 1.9.2,我的Gemfile中列出了ruby教授

    gem 'ruby-prof'
    
    2 回复  |  直到 14 年前
        1
  •  2
  •   jspooner Ryan Bigg    13 年前

    使用1.92的修补版本

    $ rvm install 1.9.2-p290 --patch gcdata --name gcdata
    
        2
  •  2
  •   Community CDub    8 年前

    这个问题有点老了,所以您可能不再需要答案,但我将在这里为其他任何可能在搜索“memory:unsupported”时遇到它的人添加一些内容。

    http://patshaughnessy.net/2010/9/28/ruby187gc-patch

    我还没有找到1.9.2的修补版本,但另一个stackoverflow答案似乎暗示1.9.2内置了GC分析: Is there a way to profile ruby 1.9.2 scripts with memory allocation reports?

    我碰巧在看一个仍然运行1.8.7的老应用程序,所以我没有进一步看1.9.2