LoginSignup
2
0

More than 3 years have passed since last update.

処理の前後で作成されたObject数を数える

Posted at
GC.start
allocated_before = GC.stat(:total_allocated_objects) #=> ex: 108391
# ..何らかの処理..
allocated_after = GC.stat(:total_allocated_objects) #=> ex: 108871

puts "Object count: #{allocated_after - allocated_before}"

Ref. https://gist.github.com/apauly/3f547f06e83b66e4187e48519b426464

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0