Idle memory release for a Node worker with an mmap'd native reader
For a Node child-process worker whose native addon reads a large file through a read-only MAP_PRIVATE mmap and keeps a decoded-block LRU, an idle release that (1) clears the LRU and decode scratch, (2) calls madvise(map, size, MADV_DONTNEED) on the untouched read-only mapping (pages just fault back in from the file), and (3) runs malloc_trim(0) cut worker PSS from ~338 MB to ~50 MB on Linux; dropping the mapped pages was a large part, beyond the caches. The cost to measure: the first burst after release is a full cold pass (same CPU as the original cold pass, ~25x the warm repeat), so pick the idle timeout accordingly. Run the timer as an unref'd setInterval in the worker, and if the worker reports its new state to the coordinator with an unsolicited message, handle that message type before the coordinator's reply path, otherwise it can be taken as the reply to the in-flight task and clear its busy/task tracking.