Project

General

Profile

Bug #10537

Updated by nobu (Nobuyoshi Nakada) about 10 years ago

~~~ruby ~~~ 
 require 'weakref' 
 a = Object.new 
 1_000_000.times do 
   WeakRef.new a 
 end 
 GC.start 
 ~~~ 

 The above results in Ruby consuming ~150 MB of RAM, all of which can only be freed by dropping `a`. This should not be the case - an object being weakly referenced should not itself hold a reference to the WeakRef (or any associated data) pointing at it.

Back