Skip to content

Instantly share code, notes, and snippets.

@frsyuki
Last active November 12, 2015 02:17
Show Gist options
  • Save frsyuki/bf64e710d666e629b10a to your computer and use it in GitHub Desktop.
Save frsyuki/bf64e710d666e629b10a to your computer and use it in GitHub Desktop.
require 'msgpack'
sleep 10
array = ["abc" * 1024] * 100
100000.times do
packer = MessagePack::Packer.new
packer.write(array)
end
require 'pp'
pp GC.stat
#=> with malloc
# {:count=>30,
# :heap_allocated_pages=>236,
# :heap_sorted_length=>237,
# :heap_allocatable_pages=>10,
# :heap_available_slots=>96200,
# :heap_live_slots=>88281,
# :heap_free_slots=>7919,
# :heap_final_slots=>0,
# :heap_marked_slots=>46495,
# :heap_swept_slots=>52255,
# :heap_eden_pages=>226,
# :heap_tomb_pages=>10,
# :total_allocated_pages=>236,
# :total_freed_pages=>0,
# :total_allocated_objects=>762810,
# :total_freed_objects=>674529,
# :malloc_increase_bytes=>1715472,
# :malloc_increase_bytes_limit=>16777216,
# :minor_gc_count=>24,
# :major_gc_count=>6,
# :remembered_wb_unprotected_objects=>509,
# :remembered_wb_unprotected_objects_limit=>1004,
# :old_objects=>43778,
# :old_objects_limit=>78918,
# :oldmalloc_increase_bytes=>20050864,
# :oldmalloc_increase_bytes_limit=>20132659}
#=> with xmalloc
# {:count=>527,
# :heap_allocated_pages=>189,
# :heap_sorted_length=>237,
# :heap_allocatable_pages=>0,
# :heap_available_slots=>77035,
# :heap_live_slots=>49711,
# :heap_free_slots=>27324,
# :heap_final_slots=>0,
# :heap_marked_slots=>43878,
# :heap_swept_slots=>6687,
# :heap_eden_pages=>188,
# :heap_tomb_pages=>1,
# :total_allocated_pages=>189,
# :total_freed_pages=>0,
# :total_allocated_objects=>762925,
# :total_freed_objects=>713214,
# :malloc_increase_bytes=>23763088,
# :malloc_increase_bytes_limit=>33554432,
# :minor_gc_count=>512,
# :major_gc_count=>15,
# :remembered_wb_unprotected_objects=>504,
# :remembered_wb_unprotected_objects_limit=>1008,
# :old_objects=>43345,
# :old_objects_limit=>86692,
# :oldmalloc_increase_bytes=>54150112,
# :oldmalloc_increase_bytes_limit=>88660647}
while true; do
ps -p $1 -o vsz=,%cpu= >> prof5.log
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment