Linux Terminal Memory Usage

Hacker News Top Tools

Summary

The author investigates excessive memory usage by the `kitty` terminal on Linux, performing a benchmark to compare resource consumption across various terminals including `xterm`, `alacritty`, `gnome-terminal`, and `konsole`. The analysis demonstrates that lightweight terminals like `xterm` and `st` offer significantly lower memory footprints compared to modern GPU-accelerated alternatives.

No content available
Original Article
View Cached Full Text

Cached at: 05/11/26, 09:55 PM

# Linux Terminal Memory Usage Source: [https://gilesorr.com/blog/linux-terminal-memory-usage.html](https://gilesorr.com/blog/linux-terminal-memory-usage.html) I use terminals*a lot*\. On most machines, I have anywhere from five to ten of them open across one to four desktops \(there are 12 terminals open on two desktops on the machine I'm writing on\)\. Having started using Linux in 1996, I used`xterm`because it was the baseline\. I found`rxvt`around 1998 and used that for a few years\. I'm not sure how it went from there, but about three years ago I was mostly using`lxterminal`but switched to`alacritty`because it did most things right and worked in both X11 and Wayland \(I'm stuck between those two worlds\)\. However, a little less than a year ago I discovered`kitty`which was very appealing because it ticked the same boxes as`alacritty`but also supported pixel\-perfect rendering of photos IN THE TERMINAL \(using`timg`\-[https://github\.com/hzeller/timg](https://github.com/hzeller/timg)\) \.\.\. which is very handy when you're SSHed to a remote web server\. I switched most of my machines to`kitty`\. About six weeks ago, I noticed that one of my machines was incredibly sluggish because it was drowning in swap\. It's a relatively old machine with an i7 processor and a spinning disk \.\.\. but it had 16G of memory and I wasn't doing anything memory\-intensive like video editing or running a large database\. This provided a learning opportunity, and I discovered`smem`\([https://www\.selenic\.com/smem/](https://www.selenic.com/smem/)\.\.\. also available in both the Fedora and Debian repositories\)\. It reports the memory usage of processes \(including USS, PSS \- which`smem`claims is a better way of looking at memory usage, RSS, and Swap\)\. And what I immediately found was that ten instances of`kitty`had chewed through all my swap\. 50G of swap\. \(Why I had that much on the machine I don't know \- probably some failed or forgotten experiment\.\) I killed all instances of`kitty`and replaced them with ten instances of`xterm`and the 50G of swap that had been full was completely empty\. `xterm`isn't particularly beautiful, but I don't use the stuff other people would miss like tabs and menus\. I miss transparency a bit, but it's not a big deal\. I'll keep`kitty`around because of`timg`, although that's a relatively rare use\-case\. I started switching most of my machines back to`alacritty`, and wondered what I should use in the long term\. This inspired me to devise a test: I would run every terminal I was considering all at once \- better yet, one set on Wayland and one set on X11 \- and then run the same set of commands in every terminal\. And measure the memory usage\. ## Openbox / X11 ### Before the Commands Were Run ``` PID Command Swap USS PSS RSS 115733 st 0 2592 3008 12788 115892 xterm 0 6808 7414 17732 115207 lxterminal 0 6528 9891 41380 114856 /usr/libexec/gnome-terminal 0 10252 14984 52836 115034 /usr/bin/kitten __atexit__ 0 19772 19783 21168 114615 alacritty 0 34224 43478 98396 131279 konsole 0 35108 50308 101220 115005 kitty 0 56376 66584 129180 115381 ptyxis 0 54760 67603 144640 ``` ### After the Commands Were Run ``` PID Command Swap USS PSS RSS 115733 st 0 3396 3834 13780 115207 lxterminal 0 7800 11159 42656 115892 xterm 0 11640 12266 22748 114856 /usr/libexec/gnome-terminal 0 10692 15416 53340 115034 /usr/bin/kitten __atexit__ 0 21972 21983 23368 114615 alacritty 0 40188 49444 104408 131279 konsole 0 38528 54193 106256 115381 ptyxis 0 58252 71107 148316 115005 kitty 0 70716 80917 143568 ``` ## KDE / Wayland ### Before the Commands Were Run ``` PID Command Swap USS PSS RSS 30975 st 0 2924 3374 12832 31112 xterm 0 6460 6691 13204 7905 foot 0 5096 7110 17296 30850 rxvt 0 8936 9440 19248 29538 lxterminal 0 9200 14622 47240 29259 /usr/libexec/gnome-terminal 0 12168 19005 53420 29417 /usr/bin/kitten __atexit__ 0 22852 22864 24464 29098 alacritty 0 25468 28837 73416 43371 /usr/bin/konsole 0 27348 39068 130252 29401 kitty 0 46468 51520 105816 29690 ptyxis 0 73220 79204 141012 ``` ### After the Commands Were Run ``` PID Command Swap USS PSS RSS 30975 st 0 3204 3820 13836 31112 xterm 0 9888 10119 16632 7905 foot 0 8764 11114 21704 30850 rxvt 0 12872 13736 27096 29538 lxterminal 0 9824 15343 48804 29259 /usr/libexec/gnome-terminal 0 12660 19313 54056 29417 /usr/bin/kitten __atexit__ 0 22884 22896 24496 29098 alacritty 0 34188 37470 82580 43371 /usr/bin/konsole 0 33244 48094 145496 29401 kitty 0 53048 58032 112936 29690 ptyxis 0 75060 81130 143284 ``` You may notice some anomalies:`rxvt`wasn't measured on one machine\. The controls were poor all around: terminals were different sizes, had different scrollback buffers, etc\. But since the results above show a spread with the memory usage of the smallest being less than one tenth that of the largest, we're not measuring subtle differences here\. So I'm not too concerned\. The results are really interesting: - I didn't think I would find a terminal with less memory use than`xterm`\- but`st`beats it by a noticeable margin - I didn't think I would find a terminal that was more of memory hog than`kitty`\(although if you add accessory app`kitten`'s memory usage, maybe it still "wins"\) - I expected`gnome\-terminal`'s memory usage to be in line with`konsole`\(KDE's default terminal\), but`gnome\-terminal`shows remarkably well in this test - the environment \(Fedora vs Debian, Wayland vs X11\) doesn't seem to have made much difference at all - I was surprised to find that`konsole`supports pixel\-perfect images from`timg`\.`timg`was the original reason I switched to`kitty`and the list of terminals that support`timg`at pixel level is short\. The others that I'm aware of are`foot`\(tested under Wayland only as it doesn't work in X11\) and`ghostty`\(not tested because I'm sticking to terminals in the Debian repos\)\.`foot`also seems to prove that you can have reasonable memory usage and support`timg`\- good to know\. I think I'm going to try out`st`some more\. Not that my machines are memory\-constrained, but if it meets my other needs, why not use the least memory\-hungry terminal? Since I commonly run ten terminals, it adds up\. If`st`doesn't work for me, I'm going to try out`gnome\-terminal`\. ## Update\(s\) **2026\-05\-08**:`st`turns out to have**NO**scrollback\. I'm now leaning to`lxterminal`for X11, and`foot`for Wayland\. I should have noted: terminals compiled for X11 run in Wayland just fine because there's an X11 compatibility layer\. There's no such thing going the other way, so Wayland\-native terminals \(like`foot`\) don't run under X11\.

Similar Articles

@Fenng: 期待一下

X AI KOLs Following

Mitchell Hashimoto announces significant memory usage improvements in the upcoming 1.4 release of the Ghostty terminal emulator, with up to 450x lower memory for non-visible windows.

Finding and Fixing Ghostty's Largest Memory Leak

Mitchell Hashimoto

A detailed technical post on diagnosing and fixing a major memory leak in the Ghostty terminal emulator, caused by a logic bug in scrollback pruning with non-standard page sizes. The fix has been merged and will be in the upcoming 1.3 release.

Reclaim the terminal

Lobsters Hottest

The article explains how interactive programs like `less` and `fzf` maintain keyboard access when input is piped, detailing the use of file descriptors and /dev/tty for direct terminal communication.