What\'s the best way to get the size of a given hash (or any object really) in bytes in Ruby 1.9.3?
The solution to \"Find number of bytes a particular Hash is using in
An alternative way of having a rough estimate of the size of a hash is to convert it into a string and count the number of characters, each character will be a byte.
hash = {hello: "world"}
=> {:hello=>"world"}
hash.to_s
=> "{:hello=>\"world\"}"
hash.to_s.size
=> 17
Then you can use a characters to bytes/megabytes calculator