> Tempfile allocates far lot more objects internally than plain File
> objects.  If you allow garbage collection for these tempfile objects,
> its consumption stays moderate. Can you remove "temps" variable from
> your example?

I can understand that, but this fragment uses 320MB of memory, ie. about
300KB per closed Tempfile. That seems wildly unreasonable to me. With
regular files the total size of the ruby process is 3.2MB!

temps = []
1000.times {
  |i|
  t = Tempfile.new("blah#{i}.txt", ".")
  t.puts "hello world"
  t.close
  temps << t
}

puts "Done"
gets


I use ruby 1.8.0 (pragprog build) on Windows XP.

Cheers,

Thomas