<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/finding-and-fixing-ghostty-s-largest-memory-leak-e80o1yj0s" -->

---
title: Finding and Fixing Ghostty's Largest Memory Leak | daily.dev
description: Ghostty's creator details a memory leak that caused the terminal emulator to consume up to 37 GB of memory after extended use. The bug stemmed from a...
canonical: https://daily.dev/posts/finding-and-fixing-ghostty-s-largest-memory-leak-e80o1yj0s
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Finding and Fixing Ghostty's Largest Memory Leak | daily.dev
og:description: Ghostty's creator details a memory leak that caused the terminal emulator to consume up to 37 GB of memory after extended use. The bug stemmed from a...
og:url: https://daily.dev/posts/finding-and-fixing-ghostty-s-largest-memory-leak-e80o1yj0s
og:image: https://api.daily.dev/og/posts/e80O1yJ0S.png
og:image:alt: Finding and Fixing Ghostty's Largest Memory Leak
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Finding and Fixing Ghostty's Largest Memory Leak

**[Mitchell Hashimoto](https://daily.dev/sources/mitchellh)** · 7 min read · 14 upvotes · 4 comments

## Summary

Ghostty's creator details a memory leak that caused the terminal emulator to consume up to 37 GB of memory after extended use. The bug stemmed from a scrollback optimization that reused pages but incorrectly reset metadata to standard size while leaving large mmap allocations intact, preventing munmap from being called. The issue became prominent with Claude Code's CLI, which produces many multi-codepoint graphemes requiring non-standard pages. The fix prevents reusing non-standard pages during scrollback pruning, instead properly freeing them and allocating fresh standard-sized pages from the pool.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://mitchellh.com/writing/ghostty-memory-leak-fix>

## Community discussion

Top comments from developers on daily.dev.

**@ghost** · 0 upvotes

> Am I the only one who thinks this whole thing with managing non-standard and standard pages was a bit over engineered.

**@frear** · 0 upvotes

> We got used to it, why are they fixing it? Golden feature, when you move ghostty between displays and it got shut down all of a sudden, leaving the mouse pointer by itself, freeing all your claude code tabs. That should stay like more than a year so everyone will learn how to save the ids of sessions.

## Similar posts on daily.dev

- [Ghostty 1.3 terminal brings big new features](https://daily.dev/posts/ghostty-1-3-terminal-brings-big-new-features-i6zyhnirj) · omg\! ubuntu\! · 192 upvotes · 25 comments
- [Ghostty Terminal: Never Understood the Hype Until I tried it](https://daily.dev/posts/ghostty-terminal-never-understood-the-hype-until-i-tried-it-fhwfcvjbc) · It's Foss · 54 upvotes · 5 comments

---

Tags: [#performance](https://daily.dev/tags/performance), [#zig](https://daily.dev/tags/zig)

[View this post on daily.dev](https://daily.dev/posts/finding-and-fixing-ghostty-s-largest-memory-leak-e80o1yj0s)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Finding and Fixing Ghostty's Largest Memory Leak","url":"https://daily.dev/posts/finding-and-fixing-ghostty-s-largest-memory-leak-e80o1yj0s","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/finding-and-fixing-ghostty-s-largest-memory-leak-e80o1yj0s"},"datePublished":"2026-01-10T18:26:13.707Z","dateModified":"2026-01-10T18:26:35.265Z","description":"Ghostty's creator details a memory leak that caused the terminal emulator to consume up to 37 GB of memory after extended use. The bug stemmed from a...","image":"https://media.daily.dev/image/upload/s--VDukGCjf--/f_auto/v1722860399/public/Placeholder%2002","thumbnailUrl":"https://media.daily.dev/image/upload/s--VDukGCjf--/f_auto/v1722860399/public/Placeholder%2002","isAccessibleForFree":true,"articleSection":"Mitchell Hashimoto","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Mitchell Hashimoto","logo":"https://media.daily.dev/image/upload/s--9zTxbLer--/f_auto/v1735476334/logos/mitchellh","url":"https://daily.dev/sources/mitchellh"},"commentCount":4,"discussionUrl":"https://daily.dev/posts/finding-and-fixing-ghostty-s-largest-memory-leak-e80o1yj0s","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":14},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":4}],"keywords":"performance,zig","timeRequired":"PT7M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Mitchell Hashimoto","item":"https://daily.dev/sources/mitchellh"},{"@type":"ListItem","position":3,"name":"Finding and Fixing Ghostty's Largest Memory Leak"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/finding-and-fixing-ghostty-s-largest-memory-leak-e80o1yj0s","comment":[{"@type":"Comment","text":"Am I the only one who thinks this whole thing with managing non-standard and standard pages was a bit over engineered.","datePublished":"2026-01-10T18:59:14.705Z","url":"https://daily.dev/posts/e80O1yJ0S#c-T9RJkzp7u","author":{"@type":"Person","name":"Deleted user","url":"https://daily.dev/ghost","image":"https://media.daily.dev/image/upload/s--hNIUzLiO--/f_auto/v1705327420/public/ghost_vlftth"}},{"@type":"Comment","text":"We got used to it, why are they fixing it? Golden feature, when you move ghostty between displays and it got shut down all of a sudden, leaving the mouse pointer by itself, freeing all your claude code tabs. That should stay like more than a year so everyone will learn how to save the ids of sessions.","datePublished":"2026-01-16T17:22:15.038Z","url":"https://daily.dev/posts/e80O1yJ0S#c-0iziZN3Mz","author":{"@type":"Person","name":"Erdem Yavuz","url":"https://daily.dev/frear","image":"https://lh3.googleusercontent.com/a/ACg8ocLvDGoMaSPIH66cDBcZdtADLrhVp_jIgCQEBFLzNglYAX4js8w=s96-c"}}]}
```

