Recently I posted a gripe about `kitty`'s memory usage.  This got me curious about memory usage of terminals in general, so I devised a test.  It wasn't all that well controlled, but I did open eight different terminals on two different machines (one KDE/Wayland/Fedora 44 and one Openbox/X11/Debian 13, both amd64 with 16G of memory, recent kernels, etc.) and ran the same sequence of commands in all 16 terminals.  I used `smem` to record the memory usage for the terminals, both right after they were opened and then after the sequence of commands was run.

==== Openbox / X11 / Debian 13 ====

  PID Command                         Swap      USS      PSS      RSS
115733 st                                 0     2592     3008    12788
115892 xterm                              0     6808     7414    17732
114856 /usr/libexec/gnome-terminal        0    10252    14984    52836
115034 /usr/bin/kitten __atexit__         0    19772    19783    21168
114615 alacritty                          0    34224    43478    98396
115005 kitty                              0    56376    66584   129180
115381 ptyxis                             0    54760    67603   144640

  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
115381 ptyxis                             0    58252    71107   148316
115005 kitty                              0    70716    80917   143568

==== KDE / Wayland / Fedora 44 ====

  PID Command                         Swap      USS      PSS      RSS
30975 st                                 0     2924     3374    12832
31112 xterm                              0     6460     6691    13204
30850 rxvt                               0     8936     9440    19248
29259 /usr/libexec/gnome-terminal        0    12168    19005    53420
29417 /usr/bin/kitten __atexit__         0    22852    22864    24464
29098 alacritty                          0    25468    28837    73416
29401 kitty                              0    46468    51520   105816
29690 ptyxis                             0    73220    79204   141012

  PID Command                         Swap      USS      PSS      RSS
30975 st                                 0     3204     3820    13836
31112 xterm                              0     9888    10119    16632
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
29401 kitty                              0    53048    58032   112936
29690 ptyxis                             0    75060    81130   143284

The results are ... interesting:
- I didn't think I would find a terminal with less memory use than `xterm`
- I didn't think I would find a terminal that was more of memory hog than `kitty` (although if you add `kitten`'s memory usage, maybe it still wins)
- I expected `gnome-terminal`'s memory usage to be in line with KDE's `ptyxis`, 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
- of the terminals, `kitty` is the only one that can show pixel-perfect images with `timg` (that was one of the commands I ran)

- `lxterminal` doesn't appear on either first recording, my mistake
- `rxvt` was running but wasn't recorded properly on the X11 machine, don't know why
- all of these terminals (and `smem`) are available from the distro repos - both Fedora and Debian

I think I'm going to try out `st` some more.  Not that my machines are that badly memory-constrained, but if it meets my other needs, why not use the least memory-hungry terminal?  Since I commonly have about ten terminals running across 2-3 desktops, it adds up.  If `st` doesn't work for me, I'm going to try out `gnome-terminal` some more.

(I'm also likely to post this on my blog.)

--
Giles
https://www.gilesorr.com/
gilesorr@gmail.com