主要/次要GC未运行

时间:2018-04-10 19:39:40

标签: ruby-on-rails ruby garbage-collection unicorn

我在Ruby应用程序中调试内存泄漏( Ruby 2.1.2 )。在收集独角兽主过程的GC统计数据的同时,我发现了主要的&次要GC计数没有变化。以下是GC统计数据示例:

  

{:count => 273,:heap_used => 10181,:heap_length => 12252,:heap_increment => 2071,:heap_live_slot => 4113806,:heap_free_slot => 35946,:heap_final_slot =&gt ; 0 ,: heap_swept_slot => 655582,:heap_eden_page_length => 10181,:heap_tomb_page_length => 0,:total_allocated_object => 132076290,:total_freed_object => 127962484,:malloc_increase => 164098552,:malloc_limit => 30949538,:minor_gc_count => 260,:major_gc_count => 13 ,:remembered_shady_object => 19831,:remembered_shady_object_limit => 29756,:old_object => 699918,:old_object_limit => 1069156 ,:oldmalloc_increase => 185902224,:oldmalloc_limit => 58937052}

大约7个小时后:

  

{:count => 273,:heap_used => 23353,:heap_length => 39695,   :heap_increment => 16342,:heap_live_slot => 9482797,   :heap_free_slot => 35840,:heap_final_slot => 0,:heap_swept_slot => 655582,   :heap_eden_page_length => 23353,:heap_tomb_page_length => 0,   :total_allocated_object => 137445281,:total_freed_object => 127962484,   :malloc_increase => 663823560,:malloc_limit => 30949538,   :minor_gc_count => 260,:major_gc_count => 13 ,   :remembered_shady_object => 19831,   :remembered_shady_object_limit => 29756,:old_object => 699918,   :old_object_limit => 1069156,:oldmalloc_increase => 685627232,   :oldmalloc_limit => 58937052}

根据我的理解,如果:oldmalloc_increase crosses:oldmalloc_limit则触发主要GC。此外,如果:malloc_increase交叉:malloc_limit将触发次要GC。

在我的情况下,oldmalloc_increase& malloc_increase超出限制仍未触发GC。

任何人都可以帮我解决以下问题:

  1. 为什么未触发次要/主要GC?
  2. malloc_increase& oldmalloc_increase不断增加,导致OOM问题。如果我重新启动我的应用程序,则这两个值都将重置为正常范围。这是否意味着我的Ruby应用程序正在泄漏内存?内存是否因为GC没有运行而被释放?

0 个答案:

没有答案
相关问题