I'm using a lot of Tempfile's and I have been made aware that they
consume a lot of memory.

I've examined the size of the ruby process right before it exits in
the example below, where I make 100 Tempfiles (and for comparison 100
ordinary Files in another run):

require 'tempfile'

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

Uses 38852KB of memory with Tempfile and only 2820KB of memory with
File (commented out above).

What's up with that?

Cheers,

Thomas