-
-
Notifications
You must be signed in to change notification settings - Fork 966
File handle leak on OS X #59
Copy link
Copy link
Closed
Description
The following code quickly runs into a panic: too many open files on OS X, even though the documentation says that Close removes all watches.
package main
import "gopkg.in/fsnotify.v1"
func main() {
for {
println("loop")
w, err := fsnotify.NewWatcher()
if err != nil {
panic(err)
}
go func() {
for range w.Events {
}
}()
go func() {
for range w.Errors {
}
}()
if err := w.Add("test.go"); err != nil {
panic(err)
}
// uncomment this to make the leak go away
// if err := w.Remove("test.go"); err != nil {
// panic(err)
// }
if err := w.Close(); err != nil {
panic(err)
}
}
}
Reactions are currently unavailable