Ruby 1.9.3有很高的内存泄漏?

时间:2013-07-22 23:29:40

标签: ruby memory memory-leaks valgrind ruby-1.9.3

我最近从ruby 1.8.7(p371)切换到ruby 1.9.3(p429),并观察到高内存泄漏(?)。我长时间运行的脚本最终都会因耗尽内存而被杀死。尝试使用一些探查器(rubyprof,memprof,bleakhouse等)来追踪,但似乎他们没有对1.9.3的良好支持。 刚刚使用valgrind跟踪C级的内存使用情况并观察到高泄漏,我运行以下示例代码:

A = ['na', 'ns', 'n/a.jpg']
b = 'N/A.jpg'
if A.include?(b.downcase)
  puts 'yes'
end

很简单。在ruby 1.8.7中,我尝试了valgrind --partial-loads-ok = yes --undef-value-errors = no --leak-check = full ruby​​ test.rb,它给出了结果:

LEAK SUMMARY:
==28315==    definitely lost: 0 bytes in 0 blocks
==28315==    indirectly lost: 0 bytes in 0 blocks
==28315==      possibly lost: 16,464 bytes in 431 blocks
==28315==    still reachable: 15,103,747 bytes in 110,826 blocks
==28315==         suppressed: 0 bytes in 0 blocks

在1.9.3中,它给出了以下结果:

LEAK SUMMARY:
==28228==    definitely lost: 2,028,264 bytes in 9,246 blocks
==28228==    indirectly lost: 1,221,720 bytes in 23,812 blocks
==28228==      possibly lost: 21,251 bytes in 432 blocks
==28228==    still reachable: 754,268 bytes in 15,849 blocks
==28228==         suppressed: 0 bytes in 0 blocks

我在rb_longjmp,rb_is_eq_eval,rb_class_new_instance,rb_ary_each ....方法中观察到泄漏。这是否意味着红宝石1.9.3有泄漏?有什么解决方法吗?

0 个答案:

没有答案