From 810ebae8e8eca363b46553b62db7fc7bfe69e24b Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 6 Apr 2026 06:56:03 -0700 Subject: [PATCH] terminal: lower default kitty image storage limit for libghostty The default kitty image storage limit was 320 MB for all build artifacts. For libghostty, this is overly generous since it is an embedded library where conservative memory usage is preferred. Lower the default to 10 MB when building as the lib artifact while keeping the 320 MB default for the full Ghostty application. --- src/terminal/Screen.zig | 5 ++++- src/terminal/Terminal.zig | 9 ++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/terminal/Screen.zig b/src/terminal/Screen.zig index f93ec999c..b56701838 100644 --- a/src/terminal/Screen.zig +++ b/src/terminal/Screen.zig @@ -255,7 +255,10 @@ pub const Options = struct { /// The total storage limit for Kitty images in bytes for this /// screen. Kitty image storage is per-screen. - kitty_image_storage_limit: usize = 320 * 1000 * 1000, // 320MB + kitty_image_storage_limit: usize = switch (build_options.artifact) { + .ghostty => 320 * 1000 * 1000, // 320MB + .lib => 10 * 1000 * 1000, // 10MB + }, /// The limits for what medium types are allowed for Kitty image loading. kitty_image_loading_limits: if (build_options.kitty_graphics) diff --git a/src/terminal/Terminal.zig b/src/terminal/Terminal.zig index b128cdd3d..f6268c719 100644 --- a/src/terminal/Terminal.zig +++ b/src/terminal/Terminal.zig @@ -194,7 +194,14 @@ pub const Options = struct { /// The total storage limit for Kitty images in bytes. Has no effect /// if kitty images are disabled at build-time. - kitty_image_storage_limit: usize = 320 * 1000 * 1000, // 320MB + kitty_image_storage_limit: usize = switch (build_options.artifact) { + .ghostty => 320 * 1000 * 1000, // 320MB + + // libghostty we start with a much lower limit since this is an + // embedded library and we want to be more conservative with memory + // usage by default. + .lib => 10 * 1000 * 1000, // 10MB + }, /// The limits for what medium types are allowed for Kitty image loading. /// Has no effect if kitty images are disabled otherwise. For example,