x = []
10_000_000.times {
x = x.concat([1])
}
p GC.stat
x = []
10_000_000.times {
x << [1]
}
p GC.stat
~ # shovel
~ ruby test.rb
{:count=>21,
:heap_allocated_pages=>24553,
:heap_sorted_length=>25668,
:heap_allocatable_pages=>1112,
:heap_available_slots=>10007821,
:heap_live_slots=>10007533,
:heap_free_slots=>288,
:heap_final_slots=>0,
:heap_marked_slots=>5814100,
:heap_swept_slots=>4651608,
:heap_eden_pages=>24553,
:heap_tomb_pages=>0,
:total_allocated_pages=>24558,
:total_freed_pages=>5,
:total_allocated_objects=>10042363,
:total_freed_objects=>34830,
:malloc_increase_bytes=>29461328,
:malloc_increase_bytes_limit=>32225676,
:minor_gc_count=>13,
:major_gc_count=>8,
:remembered_wb_unprotected_objects=>157,
:remembered_wb_unprotected_objects_limit=>314,
:old_objects=>5813924,
:old_objects_limit=>11627848,
:oldmalloc_increase_bytes=>29461776,
:oldmalloc_increase_bytes_limit=>24159190}
~ # concat
~ ruby test.rb
{:count=>446,
:heap_allocated_pages=>74,
:heap_sorted_length=>75,
:heap_allocatable_pages=>0,
:heap_available_slots=>30164,
:heap_live_slots=>29231,
:heap_free_slots=>933,
:heap_final_slots=>0,
:heap_marked_slots=>7490,
:heap_swept_slots=>6010,
:heap_eden_pages=>72,
:heap_tomb_pages=>2,
:total_allocated_pages=>74,
:total_freed_pages=>0,
:total_allocated_objects=>10042364,
:total_freed_objects=>10013133,
:malloc_increase_bytes=>6992,
:malloc_increase_bytes_limit=>16777216,
:minor_gc_count=>440,
:major_gc_count=>6,
:remembered_wb_unprotected_objects=>157,
:remembered_wb_unprotected_objects_limit=>314,
:old_objects=>7314,
:old_objects_limit=>14622,
:oldmalloc_increase_bytes=>7440,
:oldmalloc_increase_bytes_limit=>32782668}