hledger-ui --watch consumes more CPU and RAM over time [$150 x 3]
An idle hledger-ui with --watch, left running for days, may show gradually increasing CPU usage - 1%, 2%, 3%, 4%... - and RAM usage.
I have always seen this on mac, and @the-solipsist sees it on ubuntu gnu/linux. I believe it is more apparent when you have a lot of accounts / transactions. I seem to remember, or I have assumed, that it's a problem with the underlying C file-watching library (which might be different on each platform). As a workaround, you can occasionally quit and restart hledger-ui (q, C-p, enter), or suspend and resume it when not in use (C-z, fg, enter). It's quite unfortunate.
See also
- #836
- #1617
- https://github.com/haskell-fswatch/hfsnotify/issues/35
- https://github.com/haskell-fswatch/hfsnotify/issues (file watcher and windows fs interface)
- https://github.com/haskell-fswatch/hinotify/issues (linux fs interface)
- https://github.com/luite/hfsevents/issues (mac fs interface)
hledger-ui --watch uses https://hackage.haskell.org/package/fsnotify, which uses:
| Platform | Haskell lib | C lib | Problem confirmed |
|---|---|---|---|
| GNU/Linux | hinotify | the linux kernel's inotify feature | Yes |
| FreeBSD, OpenBSD | hinotify | inotify-tools port | |
| Mac | hfsevents | Cocoa CoreServices | Yes |
| WIndows | Win32 | Windows API (this?) |
This was also discussed on #836 in 2019, and is currently documented at https://hledger.org/hledger-ui.html#watch-mode-limitations.