Created
April 11, 2017 15:30
-
-
Save Shobhit1/f4ec5c9f1f47f3b8e70bb7d27a78fba9 to your computer and use it in GitHub Desktop.
Garbage collect Symbols
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
# 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