Skip to content

Instantly share code, notes, and snippets.

@gregburek
Created March 10, 2015 06:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gregburek/cb9d808f5a4b339cd6fd to your computer and use it in GitHub Desktop.
Save gregburek/cb9d808f5a4b339cd6fd to your computer and use it in GitHub Desktop.
> ObjectSpace.dump_all(output: File.open("heap.json", "w"))
> `file heap.json`
=> "heap.json: ASCII text, with very long lines\n"
> `ls -al heap.json`
=> "-rw------- 1 u47788 47788 985808896 Mar 10 05:29 heap.json\n"
> `du -sh heap.json`
=> "941M\theap.json\n"
> `cat heap.json | ruby -rjson -ne ' obj = JSON.parse($_).values_at("file","line","type"); puts obj.join(":") if obj.first '> /dev/null`
/app/vendor/bundle/ruby/2.2.0/gems/json-1.8.2/lib/json/common.rb:155:in `parse': 757: unexpected token at '{"address":"0x7f9dd68e3f20", "type":"STRING", "class":"0x7f9dc82b0ee0", "embedded":true, "bytesiz' (JSON::ParserError)
from /app/vendor/bundle/ruby/2.2.0/gems/json-1.8.2/lib/json/common.rb:155:in `parse'
from -e:1:in `<main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment