instances of Ruby tempfile automatically delete their corresponding file when releasing links. However, I have one machine on which it is not. Code
irb> require 'tempfile'
=> true
irb> t = Tempfile.new('test32')
=>
irb> exit
on all my test machines, this removes test32 except one. I tried deleting the file with File.deleteand unfortunately this works fine. Is there some kind of ruby configuration I'm missing?
Ruby version
ruby 1.8.6 (2009-06-08 patchlevel 369) [i686-linux].
Edit: Some additional information that appeared in a conversation with DigitalRoss: if I explicitly release the Tempfile link (t = nil), then Tempfile will be cleared. Is it possible that the GC has been fixed or modified in some way so that it is needed?
, "" , "" .
include ObjectSpace
t = "blah"
define_finalizer(t, proc {|id| print "yes finalized id=#{id}", "\n" })
"yes finalized" , t nil.