Finding and Fixing Ghostty's Largest Memory Leak

105 points by fluent


adam_d_ruppe

Not surprised a big tty memory leak had to do with scrollback - my custom terminal had a similar problem a while back. In the first version, I had unlimited scrollback anyway, thinking computers nowadays have so much memory it'd never be a problem, but it added up much faster than I thought, amazing how much data can be spammed into a terminal, especially if you leave it open like I do for months or years at a time... in my terminal, I used a fairly straightforward circular buffer with a max size, just letting the D garbage collector take care of the rest. Works well enough for me, though I do still have a few instances using > 200 MB of memory even now....