RE: Re: Re: Re: #<Errno::EMFILE: Too many open files

automatically closes

file for you

how do you know it is closing them? what shows in lsof?

I know because that’s what does for you. Just like
closes a file, so does

I’d verify that just to be sure. In 1.8.3 a bug was introduced where
subclasses of IO did not automatically call .close in block form. See
&atid=1698 (or ruby-core:6911).

However, I was under the impression that the core classes were
unaffected. I ran this snippet on my Windows box with 1.8.4 just to

10000.times{“test.txt”,“w”){ |fh| fh.puts “hello” }
sleep 1

Then I watched the handle and thread count in the process manager. They
never increased.

I haven’t validated this on all platforms, however.



This communication is the property of Qwest and may contain confidential
privileged information. Unauthorized use of this communication is
prohibited and may be unlawful. If you have received this communication
in error, please immediately notify the sender by reply e-mail and
all copies of the communication and any attachments.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs