Reduce terminal and dashboard memory footprint
Frontend terminal: - Share single TextDecoder across all instances (was one per terminal) - Write binary WS frames as Uint8Array directly to ghostty-web, avoiding intermediate string allocation from TextDecoder.decode() - Reduce default scrollback to 200 on mobile (was 1000; Safari mobile has ~300MB budget across all tabs) - Pause heartbeat watchdog when tab is hidden to reduce WS traffic and message queue growth for background terminals Dashboard screenshots: - Revoke old object URL before creating new one (reduces peak memory by not having two decoded bitmaps alive simultaneously) - Re-lookup card from cardsBySlug in fetch callback to avoid orphaned blob URLs when renderTiles() runs during in-flight requests - Remove thumbnailCache writes (was redundant with activeObjectURLBySlug) Server: - Halve replay buffer from 256KB to 128KB per session
This commit is contained in:
+4
-6
@@ -1270,7 +1270,6 @@ func (s *LocalServer) handleRoot(w http.ResponseWriter, r *http.Request) {
|
||||
return;
|
||||
}
|
||||
screenshotRequestInFlight = true;
|
||||
const img = card.img;
|
||||
const url = '/screenshot.svg?route_key=' + encodeURIComponent(slug);
|
||||
const controller = new AbortController();
|
||||
const timeout = setTimeout(() => controller.abort(), 5000);
|
||||
@@ -1290,14 +1289,13 @@ func (s *LocalServer) handleRoot(w http.ResponseWriter, r *http.Request) {
|
||||
})
|
||||
.then((blob) => {
|
||||
if (!blob) return;
|
||||
const currentCard = cardsBySlug[slug];
|
||||
if (!currentCard || !currentCard.img) return;
|
||||
const previous = activeObjectURLBySlug[slug];
|
||||
if (previous) URL.revokeObjectURL(previous);
|
||||
const objectURL = URL.createObjectURL(blob);
|
||||
activeObjectURLBySlug[slug] = objectURL;
|
||||
img.src = objectURL;
|
||||
thumbnailCache[slug] = { src: objectURL, updatedAt: Date.now() };
|
||||
if (previous) {
|
||||
URL.revokeObjectURL(previous);
|
||||
}
|
||||
currentCard.img.src = objectURL;
|
||||
})
|
||||
.catch(() => {})
|
||||
.finally(() => {
|
||||
|
||||
Reference in New Issue
Block a user