Merge fork main a803c87

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
localandClaude Opus 5.5 committed 2026-11-24 18:57:47 -06:00
commit 1f951910e4
22 files changed
+895 -117

No files matched your search

+5 -2
View File
@@ -1617,17 +1617,20 @@ pub(crate) fn window_use() -> [u64; 8] {
/// The next read of that memory makes a new copy and copies the window
/// again. Called before a submission starts, by the thread that submits.
pub(crate) fn let_go_idle() {
const IDLE_MS: u64 = 10_000;
const IDLE_FRAMES: u64 = 4;
let gone: Vec<Arc<Shadow>> = {
// Held from the look to the removal: `loose` hands a copy out
// under the same lock, so none is handed out in between.
let mut map = LOOSE.lock().unwrap_or_else(|e| e.into_inner());
if map.is_empty() {
return;
}
let idle_ms = crate::host::ram_idle_ms(crate::host::available_physical_ram());
let idle: Vec<(u64, u64)> = map
.iter()
.filter(|(_, s)| {
Arc::strong_count(s) == 1
&& crate::host::long_ago(s.used.load(Ordering::Relaxed), IDLE_MS, IDLE_FRAMES)
&& crate::host::long_ago(s.used.load(Ordering::Relaxed), idle_ms, IDLE_FRAMES)
&& crate::host::references(&s.buffer) == 1
})
.map(|(key, _)| *key)