mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Try GC when Too many open files (revert a part of 1e8097a).
This commit is contained in:
+6
-1
@@ -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
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
ulimit -n 20
|
||||
mruby -e '100.times { File.open "'$0'" }'
|
||||
Reference in New Issue
Block a user