有没有办法使用内存分配报告来分析 ruby​​ 1.9.2 脚本? [英] Is there a way to profile ruby 1.9.2 scripts with memory allocation reports?

查看:35
本文介绍了有没有办法使用内存分配报告来分析 ruby​​ 1.9.2 脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 ruby​​ 应用程序遇到了瓶颈,但我不知道它在哪里变慢.我找到了 memprof,但它不支持 1.9.我还发现 ruby​​-prof 似乎在 1.9.2 上运行良好,但内存分配需要打补丁的 ruby​​ 解释器,我只能找到 ruby​​ 1.8 的补丁.是否有 ruby​​ 分析器可以完成这项工作?

I'm running into bottlenecks in my ruby application, but I can't figure out where it's slowing down. I found memprof, but it doesn't support 1.9. I also found ruby-prof which seems to work fine on 1.9.2, but the memory allocation requires a patched ruby interpreter and I can only find patches for ruby 1.8. Is there a ruby profiler out there that does the job?

推荐答案

您是否尝试过分析 GC?Ruby 1.9.2 包括 GC::Profiler.

Have you tried profiling the GC? Ruby 1.9.2 includes GC::Profiler.

GC::Profiler.enable
GC.start
puts GC::Profiler.report

您可能还想查看 ObjectSpace.count_objects.

这篇关于有没有办法使用内存分配报告来分析 ruby​​ 1.9.2 脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆