From: matz@... (Yukihiro Matsumoto) Date: 2004-03-25T10:27:36+09:00 Subject: Re: Tempfile consuming a lot of memory Hi, In message "Re: Tempfile consuming a lot of memory" on 04/03/25, "Thomas Sondergaard" writes: |Having just written this, I had to do a SimpleDelegator experiment. Here's |the result. | |Size of the ruby interpreter after having created 1000 instances of: | | ADelegatingClass: 315MB | | ANondelegatingClass: 2.6MB | |Well? This is a good hint. Thomas, can you try this patch? matz. --- lib/tempfile.rb 24 Mar 2004 09:27:15 -0000 1.22 +++ lib/tempfile.rb 25 Mar 2004 01:27:09 -0000 @@ -11,3 +11,3 @@ require 'tmpdir' # thread safe. -class Tempfile < SimpleDelegator +class Tempfile < DelegateClass(File) MAX_TRY = 10 --- lib/delegate.rb 27 Jan 2004 06:04:59 -0000 1.15 +++ lib/delegate.rb 25 Mar 2004 01:27:09 -0000 @@ -113,2 +113,5 @@ def DelegateClass(superclass) end + def __setobj__(obj) + @_dc_obj = obj + end return klass;