Created
September 23, 2015 20:29
-
-
Save dpoggi/82ff2df494b9696bdedc to your computer and use it in GitHub Desktop.
Save the first 10,000 objects in Ruby's VM to a text file for inspection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
things = (0..10000).map do |n| | |
begin | |
ObjectSpace._id2ref(n) | |
rescue | |
nil | |
end | |
end | |
File.open('things.txt', 'w') do |f| | |
things.compact.each { |thing| f.puts(thing) } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment