Wezterm: High graphics memory usage compared to alacritty limits amount of open wezterm instances.

Created on 23 Oct 2020  ยท  5Comments  ยท  Source: wez/wezterm

Describe the bug

I am wondering if the graphics memory consumption could be reduced, since it limits the amount of open wezterm instances substantially.

It also seems that new wezterm instances start with 65 MiB of memory and growing slowly, while alacritty stays at 13MiB.

โฏ nvidia-smi
Fri Oct 23 10:50:59 2020
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 455.28       Driver Version: 455.28       CUDA Version: 11.1     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  Quadro K1100M       Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   44C    P8    N/A /  N/A |    855MiB /  1999MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A    175768      G   wezterm                            65MiB |
|    0   N/A  N/A   2014487      G   /usr/lib/Xorg                     174MiB |
|    0   N/A  N/A   2020473      G   alacritty                          13MiB |
|    0   N/A  N/A   2022739      G   wezterm                            68MiB |
|    0   N/A  N/A   2026162      G   wezterm                            68MiB |
|    0   N/A  N/A   2062930      G   wezterm                            96MiB |
|    0   N/A  N/A   2080660      G   wezterm                           108MiB |
|    0   N/A  N/A   2282967      G   wezterm                            88MiB |
|    0   N/A  N/A   2341131      G   wezterm                            96MiB |
|    0   N/A  N/A   4150352      G   wezterm                            65MiB |
+-----------------------------------------------------------------------------+

Environment (please complete the following information):

  • OS: archlinux
  • Version: wezterm 20200909-002054-4c9af461-163-gb2408271

To Reproduce

open some wezterm instances

Configuration

local wezterm = require 'wezterm';

return {
    default_prog = {"/usr/bin/bash"},
    check_for_updates = false,
    enable_tab_bar = false,

    font = wezterm.font_with_fallback(
        {
            "JetBrains Mono",
            "FiraCode Nerd Font",
            "Unifont",
            "Noto Color Emoji",
        }
        ),
    font_size = 11.5,
    dpi = 96.0,
    default_cursor_style = "SteadyBlock",
    scrollback_lines = 9999,
}

Expected behavior

Constant and comparable low memory consumption.

bug

Most helpful comment

so far all my wezterm instances stay below 10MiB.

All 5 comments

I've pushed a commit that uses a smaller initial atlas size. Right now the strategy is simply to double that size whenever
we overflow (eg: have more distinct glyphs/sizes to rasterize) but it would be possible to alter the logic to try zero'ing out the existing texture on the first pass and then only actually allocate if the second pass still doesn't fit.

I'm curious about the instances that have ~100MB of usage; is there anything unusual about their workload? Lots of distinct emoji/glyphs?

I use https://starship.rs/ for my prompt. My IDE is basically awsome wm + wezterm + neovim, so normally I keep my terminals open for a long time, e.g. cd into a project, start a detached https://github.com/daa84/neovim-gtk and leave the terminal to run dev-specific commands, e.g. tests, rg, fd, etc. after a working day I suspend and resume the next day. Since my actual project is quite complex, I have multiple such wezterm/neovim sessions running on several awesome tags plus here and there some extra terminals for unrelated stuff.
In addition I have an alacritty scratchpad terminal (a leftover before switching to wezterm, where I track my time or run other regular commands), which basically stays there the whole uptime and it keeps its memory constantly at 13MiB.

With the current nightly, I'm seeing 2-4MiB:

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      1439      G   /usr/libexec/Xorg                  59MiB |
|    0   N/A  N/A      2237      G   /usr/libexec/Xorg                 160MiB |
|    0   N/A  N/A      2503      G   wezterm                             4MiB |
+-----------------------------------------------------------------------------+

Initial memory is 2MiB now.

I keep watching this issue the next week and tell you later...
BTW thanks for the great work and response!

so far all my wezterm instances stay below 10MiB.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

erf picture erf  ยท  5Comments

p00f picture p00f  ยท  5Comments

sanga picture sanga  ยท  10Comments

jsgf picture jsgf  ยท  3Comments

mardukbp picture mardukbp  ยท  8Comments