fix(pidusage): prune history entries for PIDs not present in the requested set to avoid stale data and memory growth

This commit is contained in:
2026-03-02 14:38:14 +00:00
parent 56757e1c71
commit 8fd8b9a915
3 changed files with 15 additions and 1 deletions

View File

@@ -125,5 +125,12 @@ export async function getPidUsage(
});
}
// Prune history entries for PIDs no longer in the requested set
for (const histPid of history.keys()) {
if (!pids.includes(histPid)) {
history.delete(histPid);
}
}
return result;
}