hledger icon indicating copy to clipboard operation
hledger copied to clipboard

hledger-ui --watch consumes more CPU and RAM over time [$150 x 3]

Open simonmichael opened this issue 4 years ago • 25 comments

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)

simonmichael avatar Feb 03 '22 17:02 simonmichael

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?)

simonmichael avatar Feb 03 '22 17:02 simonmichael

This was also discussed on #836 in 2019, and is currently documented at https://hledger.org/hledger-ui.html#watch-mode-limitations.

simonmichael avatar Feb 03 '22 18:02 simonmichael