simonmichael / hledger

Robust, fast, intuitive plain text accounting tool with CLI, TUI and web interfaces.
https://hledger.org
GNU General Public License v3.0
2.98k stars 318 forks source link

slowly increasing cpu load with hledger-ui --watch #1825

Open simonmichael opened 2 years ago

simonmichael commented 2 years ago

An idle hledger-ui with --watch, left running for days, may show gradually increasing CPU usage - 1%, 2%, 3%, 4%... 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.

simonmichael commented 2 years ago

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 commented 2 years ago

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