terminal/kitty: evict without scratch allocation

Track each image's placement count in its existing metadata. This lets
us use constant-time usage checks (rather than scans) during eviction.

Select the best candidate directly from storage on each eviction, preserving
the existing priority order: unused status, transient hint, generation, then
ID.

Since eviction no longer allocates, it can't fail, so callers no longer
need to handle out-of-memory conditions.
This commit is contained in:
Jon Parise
2026-08-04 11:08:58 -04:00
parent 46767b5213
commit 4371871bc2
8 changed files with 155 additions and 161 deletions

View File

@@ -460,7 +460,7 @@ pub fn changeConfig(self: *Termio, td: *ThreadData, config: *DerivedConfig) !voi
};
// Set the image limits
try self.terminal.setKittyGraphicsSizeLimit(self.alloc, config.image_storage_limit);
self.terminal.setKittyGraphicsSizeLimit(self.alloc, config.image_storage_limit);
self.terminal.setKittyGraphicsLoadingLimits(.allWithTempDir(global.tmpDirPath()));
}