[MacRuby-devel] [MacRuby] #408: leaked Tempfile don't get cleaned up (MacRuby)

Laurent Sansonetti lsansonetti at apple.com
Thu Oct 29 12:29:43 PDT 2009

On Oct 29, 2009, at 12:18 PM, Matthias Neeracher wrote:
>> #408: leaked Tempfile don't get cleaned up
> [...]
>> Changes (by lsansonetti@?):
>> * status:  new => closed
>> * resolution:  => fixed
>> I implemented ObjectSpace finalizers as part of r2918 and now your  
>> snippet
>> behaves like the old Ruby.
> This does indeed fix the main problem—the program running out of  
> file descriptors. Thanks!
> The behavior still differs significantly from Ruby 1.8 behavior  
> (though it may match 1.9 this regard): When running the program I  
> included in the bug to completion, the ruby 1.8 version will clean  
> up all temp files, while the MacRuby version will leave behind  
> dozens of temp files (everything created after the last gc run).  
> Presumably, one could force this cleanup by running gc at the end of  
> the program, but I'm not sure this would be a popular thing to do in  
> the runtime, and if it matters to a client, this can be done in  
> client code.

I think this is a different bug, it looks like we don't force the call  
of all finalizers before dying.

$ ./miniruby -e "o=Object.new; ObjectSpace.define_finalizer(o, proc{p  
42}); p :dying"
$ ruby19 -e "o=Object.new; ObjectSpace.define_finalizer(o, proc{p  
42}); p :dying"

I remember we trigger a full - synchronous collection before exiting  
but apparently it doesn't help.

Could you file a new ticket on Trac for this?



More information about the MacRuby-devel mailing list