aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authoruser <user@clank>2026-09-03 16:26:41 +0200
committeruser <user@clank>2026-09-03 16:26:41 +0200
commite3059676a6b342ea9ff07753d5b976e854d4b111 (patch)
tree0bd6dd5bb7bb95503d116bddc0b7633b46d46de0 /include
parentweb: card (diff)
downloadslosh-e3059676a6b342ea9ff07753d5b976e854d4b111.tar.gz
slosh-e3059676a6b342ea9ff07753d5b976e854d4b111.tar.xz
slosh-e3059676a6b342ea9ff07753d5b976e854d4b111.zip
pane: drop the render snapshot of panes on hidden tabs -- 154K -> 66K each
An updated GhosttyRenderState retains a full copy of the pane's viewport (rows, cells, per-row arenas, styles) so renders can read it without the terminal lock. Measured with bpftrace and a lib-vt micro-benchmark, that copy is ~140KB for an 80x24 pane -- more than twice the terminal it mirrors (~57KB) -- and every pane kept one forever, composed or not. Only the current tab is ever composed, so app_compose now drops the snapshot of every pane on the other tabs (a pointer test once dropped), and pane_new no longer creates one at all: pane_compose and pane_select_word build it on first use. Both already begin with ghostty_render_state_update(), so a dropped snapshot is rebuilt, never missed, and the tab switch already forces a full repaint. Server memory per empty 80x24 terminal drops from 154K to 66K anon (Superlogical reports 68K on macOS; tmux 4K, zellij 1.2-6.2M). Fifty background tabs: 8.2M -> 3.8M, reclaimed on close, and cycling through tabs does not ratchet. What remains is the lib-vt terminal itself.
Diffstat (limited to 'include')
-rw-r--r--include/slosh.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/slosh.h b/include/slosh.h
index 47d8220..6c95426 100644
--- a/include/slosh.h
+++ b/include/slosh.h
@@ -261,6 +261,10 @@ bool pane_dirty(pane_t *p);
/* Ask for a repaint without having changed a cell: what is drawn *over* the
* pane changed, and composing is the only thing that can see that. */
void pane_touch(pane_t *p);
+/* Free the pane's retained render snapshot (~140KB for 80x24). Safe at any
+ * time: the next render rebuilds it from the terminal. Called for panes on
+ * tabs that are not on screen. */
+void pane_render_cache_drop(pane_t *p);
/* Scrollback. Negative delta scrolls up (towards older output). */
void pane_scroll(pane_t *p, int delta);
void pane_scroll_edge(pane_t *p, bool top);