From fcbf63e62c627deae76c1b8cb8c0876c536ed811 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Mon, 16 Mar 2020 18:49:26 +0900 Subject: Fresh start --- jni/ruby/sample/weakref.rb | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 jni/ruby/sample/weakref.rb (limited to 'jni/ruby/sample/weakref.rb') diff --git a/jni/ruby/sample/weakref.rb b/jni/ruby/sample/weakref.rb new file mode 100644 index 0000000..b9f38f9 --- /dev/null +++ b/jni/ruby/sample/weakref.rb @@ -0,0 +1,9 @@ +require 'weakref' + +foo = Object.new +p foo.to_s # original's class +foo = WeakRef.new(foo) +p foo.to_s # should be same class +ObjectSpace.garbage_collect +ObjectSpace.garbage_collect +p foo.to_s # should raise exception (recycled) -- cgit v1.2.3