mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-12-04 06:21:59 +09:00
On Darwin, os.freemem() counts only free and speculative pages. The kernel keeps reclaimable file cache on the inactive queue, so an idle Mac reads as a few percent "free" and the worker daemon defers almost every worker. The memory gate now measures available memory on Darwin from vm_stat as (free + speculative + inactive) x page size, clamped to totalmem, with the page size read from vm_stat's own header (16 KiB on Apple Silicon). Purgeable pages are not added because they already sit on other queues. Linux and Windows keep os.freemem() unchanged. vm_stat runs without a shell, with a 1 s timeout; concurrent checks share one probe and results are cached for 5 s. If the probe fails the gate falls back to os.freemem() and logs that once per daemon. Threshold defaults are not changed. Refs #2935 Co-authored-by: Lenin Mookiah <2639584+leninworld@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>