Skip to content

Instantly share code, notes, and snippets.

@eduardopoleo
Created July 11, 2017 01:38
Show Gist options
  • Save eduardopoleo/dd3a37b9609e1b9eff6543a940862af8 to your computer and use it in GitHub Desktop.
Save eduardopoleo/dd3a37b9609e1b9eff6543a940862af8 to your computer and use it in GitHub Desktop.
require 'objspace'
# "111...".to_i(2) A 128 "1"
big_int = 340282366920938463463374607431768211455
ObjectSpace.memsize_of(big_int) # => 40
array = [true] * 128
ObjectSpace.memsize_of(big_int) # => 1064
hash = {"a" => true, "b" => true ...}
ObjectSpace.memsize_of(big_int) # => 6536
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment