From: Love U Ruby Date: 2013-04-06T22:45:02+09:00 Subject: Why `local_variables` printing the name of local variables,while it has been garbage collected? Why `local_variables` printing the name of local variables,while it has been garbage collected? require 'weakref' a = "abc" p local_variables p defined? a p a.to_s a = WeakRef.new(a) p GC.enable GC.start p local_variables p defined? a p a.to_s Output: [:a] "local-variable" "abc" false [:a] "local-variable" true.rb:253:in `
': Invalid Reference - probably recycled (WeakRef::RefError) -- Posted via http://www.ruby-forum.com/.