serverbase: only collect when something was allocated - #427
Conversation
A bare timer made an idle server re-mark an unchanged heap every interval, using CPU and waking every core. Gate it on gcCollectMinAllocated, plus one collection once the server goes quiet. (cherry picked from commit bf96205d736e23429d65cee13de9b41565e80b88)
The loop slept a fixed interval forever, waking ~100x/second with nothing to do. Block on the reader while no request is buffered, no fiber is in flight and no timeout is pending. waitForData reports whether it really waited, so already-buffered bytes keep the old cadence rather than spin. (cherry picked from commit 36d46460563e208f05f588a67e41eb722bfeb4d4)
Release memory if we can once things have settled; an idle server no longer collects often enough to reach gcMinimizeTimes on its own. (cherry picked from commit 55abe52af1bb6440f1f602a2376fffa24e810f25)
|
CI note: the only red job here, Dub Tests (macos-latest, ldc-latest), fails in test/runtests.sh at tc_implement_interface, which dies with Program exited with code -11 (SIGSEGV) and no output. I don't believe it's related to this PR:
Timing hints the crash is at or near teardown: the passing run takes 11.2 s and flushes all seven Pass tests/*.expected lines at exit, the failing one dies at 9.8 s with nothing flushed (stdout is block-buffered, so a crash loses the lot). For what it's worth, #422 also hit Run standalone tests failing macOS-only, twice, in June — its logs have expired so I can't confirm it was the same test case. Could you re-run the macOS job? I don't have permission to. Otherwise I'm happy to push an empty commit to re-trigger it. The same applies to #425. |
A bare timer made an idle server re-mark an unchanged heap every interval,
using CPU and waking every core. Gate it on gcCollectMinAllocated, plus one
collection once the server goes quiet.
(cherry picked from commit bf96205d736e23429d65cee13de9b41565e80b88)