Handle case where swap memory query fails on windows. (#15219)

This commit is contained in:
comfyanonymous 2026-08-01 22:12:12 -07:00 committed by GitHub
parent 532a16f3b9
commit f06a187f50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -684,7 +684,11 @@ def should_free_pins_for_ram_pressure(shortfall):
return True
if psutil.virtual_memory().available < WINDOWS_PIN_EVICTION_EMERGENCY_AVAILABLE:
return True
return psutil.swap_memory().percent >= WINDOWS_PIN_EVICTION_SWAP_PERCENT
try:
return psutil.swap_memory().percent >= WINDOWS_PIN_EVICTION_SWAP_PERCENT
except RuntimeError as err:
logging.warning("Could not read Windows swap usage; falling back to RAM-pressure pin eviction: %s", err)
return True
def ensure_pin_budget(size, evict_active=False, loaded=False):
if args.high_ram: