You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Operating system and platform: Linux bree 4.14.0-2-amd64 break script engine #1 SMP Debian 4.14.7-1 (2017-12-22) x86_64 GNU/Linux
Here you have potentially offending code:
require 'pry'
class Foo
def define_bar_method(&block)
define_singleton_method(:bar, &block)
end
def remove_bar_method
singleton_class.class_eval do
remove_method :bar
end
end
end
foo = Foo.new
foo.define_bar_method {2 + 2}
foo.bar
foo.remove_bar_method
foo = nil
binding.pry
Expected Behavior
An object with a defined singleton method should be garbage collected if there are no external references pointing it.
Actual Behavior
When referenced by a Binding object from a defined singleton method, foo object is not collected by GC and it seems it should be. I try to remove singleton method before GC.
On pry stop, I try GC from visualvm. Foo object is still there if I run a memory sampling from visualvm. More GC don't change that situation.
The text was updated successfully, but these errors were encountered:
Environment
Here you have potentially offending code:
Expected Behavior
An object with a defined singleton method should be garbage collected if there are no external references pointing it.
Actual Behavior
When referenced by a Binding object from a defined singleton method, foo object is not collected by GC and it seems it should be. I try to remove singleton method before GC.
On pry stop, I try GC from visualvm. Foo object is still there if I run a memory sampling from visualvm. More GC don't change that situation.
The text was updated successfully, but these errors were encountered: