From: Aldric Giacomoni <"aldric[removeme]"@...> Date: 2008-11-28T08:55:09+09:00 Subject: "Too many open files" error Example code, on Ruby 1.8.6: require 'resolv' t0 = Time.now (1..500).each do |a| begin a = Resolv::DNS.new.getaddress("www.example.dom").to_s rescue Resolv::ResolvError a = "Hahahahaa" end end puts "#{(Time.now - t0) / 500} second per." Error: c:/ruby/lib/ruby/1.8/resolv.rb:572:in `initialize': Too many open files (Errno::EMFILE) ___________________ How can I prevent this error from happening? Can I do manual garbage collection and delete each DNS.new Object at the end of each iteration? Is there a better idea out there? Thanks, --Aldric