Skip to content

Instantly share code, notes, and snippets.

@Shobhit1
Created April 11, 2017 15:30
Show Gist options
  • Save Shobhit1/f4ec5c9f1f47f3b8e70bb7d27a78fba9 to your computer and use it in GitHub Desktop.
Save Shobhit1/f4ec5c9f1f47f3b8e70bb7d27a78fba9 to your computer and use it in GitHub Desktop.
Garbage collect Symbols
# Symbol GC test
require 'java'
java_import 'java.lang.System'
before = Symbol.all_symbols.size
100_000.times do |i|
"sym#{i}".to_sym
end
# GC.start
System.gc
after = Symbol.all_symbols.size
puts after - before
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment