-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leak on OS X #35
Comments
Thanks for the report. Can you give a minimal test program that creates the memory leak? |
Sure. This program is enough to do it: {-# LANGUAGE OverloadedStrings #-}
import System.FSNotify
import System.IO
main = withManager doWatch
doWatch m = do
putStrLn "doWatch is starting. Do something that will cause large amounts of"
putStrLn "disk activity in the current directory; my test case is to compile"
putStrLn "Firefox. Press Enter when things settle down to terminate. This"
putStrLn "program should easily reach hundreds of megabytes of memory"
putStrLn "when compiling a large program like Firefox."
watchTree m "." (const True) (\e -> putStrLn $ "Got event " ++ (show e))
getLine >> return () Instructions are included. =) If you want to try with my exact test case, you can grab a copy of the Firefox source using I just ran this twice and checked the final memory usage as reported by Activity Monitor. I got 442.9 MB on the first run and 650.7 MB on the second. |
One thing that might be related to this: I had slow performance with |
It's very possible that they're related, yeah. In my real application I filter out everything but C++ source files and the leak does seem slower. If filtered out events don't contribute to the leak, that is quite interesting. I'm not 100% sure there's actually an effect, though, because there's so much variance in the leak size. |
The |
@gregwebs I'm thinking of trying to get this fixed sometime in the near future. Which repo and branch should I work from? |
the rc branch. Thanks! |
@sethfowler I realize this was 2 years ago, but did you ever make any progress on memory leak issues? I'm running into it on Ubuntu linux as well. Setting up a watch with a broad predicate (essentially just In addition, I noticed that if I trigger a large number of files changes by invoking |
@thomasjm I didn't, unfortunately. I just ended up periodically killing and restarting the thread on a timer. |
Note to self: try replacing Chans with |
We see this with hledger-ui too. [Using watchDir, with a restrictive predicate matching only a few files.] |
There seems to be a memory leak when using this library on OS X. I am not sure if it comes from code in System.FSNotify or from the underlying System.OSX.FSEvents, though.
The text was updated successfully, but these errors were encountered: