Try GC when Too many open files (revert a part of 1e8097a).

This commit is contained in:
Tomoyuki Sahara
2013-11-16 16:04:31 +09:00
parent e44da8a6cc
commit 87d878292d
2 changed files with 10 additions and 1 deletions
+6 -1
View File
@@ -14,7 +14,12 @@ class File < IO
super(fd_or_path, mode)
else
@path = fd_or_path
fd = IO.sysopen(@path, mode, perm)
begin
fd = IO.sysopen(@path, mode, perm)
rescue Errno::EMFILE
GC.start
fd = IO.sysopen(@path, mode, perm)
end
super(fd, mode)
end
end
+4
View File
@@ -0,0 +1,4 @@
#!/bin/sh
ulimit -n 20
mruby -e '100.times { File.open "'$0'" }'