All I want to know is how many bytes Ruby is using for a particular Hash object. How do I do that?
In tenderlove's talk on Ruby 1.9 at GoGaRuCo 2010, I learned about some stuff added to ObjectSpace in 1.9 that would seem to do the trick.
require "objspace"
obj = {some:"STUFF"}
ObjectSpace.memsize_of(obj) # => you can imagine
Found some docs on objspace but a lot of it is Japanese. There's some English in there if you keep looking.
Still not sure how I can get the memory size of an object in 1.8.7 by using Ruby.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With