Skip to content

Instantly share code, notes, and snippets.

@senny
Created October 8, 2010 19:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save senny/617409 to your computer and use it in GitHub Desktop.
Save senny/617409 to your computer and use it in GitHub Desktop.
GC.disable
objects = ObjectSpace.count_objects
start = objects[:TOTAL]
puts "objects: #{start}" # => 9811
1_000_000.times do
"I am a lonly" + " concatenated" + " string" + "."
end
end_objects = ObjectSpace.count_objects(objects)[:TOTAL]
puts "objects: #{end_objects}"
puts "difference: #{end_objects - start}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment