Skip to content

Instantly share code, notes, and snippets.

@t3hk0d3
Last active December 6, 2016 15:28
Show Gist options
  • Save t3hk0d3/b7a5667d6c696c9b41781a8de9217b00 to your computer and use it in GitHub Desktop.
Save t3hk0d3/b7a5667d6c696c9b41781a8de9217b00 to your computer and use it in GitHub Desktop.
def test(&block)
GC.disable
before_strings = ObjectSpace.each_object(String).to_a
yield
after_strings = ObjectSpace.each_object(String).to_a
p after_strings - before_strings
GC.enable
end
puts "Before"
ababa = ["test", 'hello', 'world']
test do
"epic" * 20
"longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong"
"text"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment