wezterm icon indicating copy to clipboard operation
wezterm copied to clipboard

Wezterm using 22 GB of RAM?

Open acampove opened this issue 1 month ago • 3 comments

What Operating System(s) are you seeing this problem on?

Linux X11

Which Wayland compositor or X11 Window manager(s) are you using?

I am just using almalinux9 with X11

WezTerm version

wezterm 20251025-070338-b6e75fd7

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

Yes, and I updated the version box above to show the version of the nightly that I tried

Describe the bug

For some reason, when using wezterm with workspaces, I seem to use 11 Gb per window and eventually I have to kill the process because it makes my machine irresponsive. When I reopen the wezterm, all the workspaces are gone, which is pretty annoying, given that I work with 5-10 workspaces and I have to reopen them all over again.

Image

To Reproduce

No response

Configuration

local wezterm = require("wezterm")
local mux     = wezterm.mux

wezterm.on("gui-startup", function(cmd)
    local tab, pane, window = mux.spawn_window(cmd or {})
    window:gui_window():maximize()
end)

local config = wezterm.config_builder()

config.font                         = wezterm.font("MesloLGS Nerd Font Mono")
config.term                         = "xterm-256color"
config.font_size                    = 19
config.color_scheme                 = "TokyoNight"
config.scrollback_lines             = 10000
config.enable_tab_bar               = false
config.window_decorations           = "RESIZE"
config.window_background_opacity    = 0.9
config.macos_window_background_blur = 10

config.window_padding = {
    top    = 10,
    bottom = 10,
    left   = 10,
    right  = 10,
}

config.leader = { key = "a", mods = "CTRL"  , timeout_milliseconds = 2000 }
config.unix_domains = {
    {
        name = "unix",
    },
}

config.front_end       = 'Software'
config.default_domain = "unix"

local action = wezterm.action

config.keys = {
    -- Copy mode
    { key = "[", mods = "LEADER", action = action.ActivateCopyMode },
    -- Split into panes
    {
        key    = "v",
        mods   = "LEADER",
        action = action.SplitHorizontal({ domain = "CurrentPaneDomain" }),
    },
    {
        key = "h",
        mods = "LEADER",
        action = action.SplitVertical({ domain = "CurrentPaneDomain" }),
    },
    -- Adjust size, META is ALT
    {
        key = "LeftArrow",
        mods = "META",
        action = action.AdjustPaneSize({ "Left", 5 }),
    },
    {
        key = "RightArrow",
        mods = "META",
        action = action.AdjustPaneSize({ "Right", 5 }),
    },
    {
        key = "DownArrow",
        mods = "META",
        action = action.AdjustPaneSize({ "Down", 5 }),
    },
    {
        key = "UpArrow",
        mods = "META",
        action = action.AdjustPaneSize({ "Up", 5 }),
    },
    -- Zoom to pane
    {
        key = "z",
        mods = "LEADER",
        action = action.TogglePaneZoomState,
    },
    -- Move to other windows
    {
        key = "c",
        mods = "LEADER",
        action = action.SpawnTab("CurrentPaneDomain"),
    },
    {
        key = "p",
        mods = "LEADER",
        action = action.ActivateTabRelative(-1),
    },
    {
        key = "n",
        mods = "LEADER",
        action = action.ActivateTabRelative(1),
    },
    -- Move to other panes
    {
        key    = "DownArrow",
        mods   = "CTRL",
        action = action.ActivatePaneDirection "Down",
    },
    {
        key    = "UpArrow",
        mods   = "CTRL",
        action = action.ActivatePaneDirection "Up",
    },
    {
        key    = "LeftArrow",
        mods   = "CTRL",
        action = action.ActivatePaneDirection "Left",
    },
    {
        key    = "RightArrow",
        mods   = "CTRL",
        action = action.ActivatePaneDirection "Right",
    },
    -- Move panes
    {
        key = "Space",
        mods = "LEADER",
        action = wezterm.action.RotatePanes "Clockwise"
    },
    {
        key    = '0',
        mods   = 'LEADER',
        action = wezterm.action.PaneSelect { mode = 'SwapWithActive', },
    },
    { 
        key    = "x", 
        mods   = "LEADER", 
        action = action.CloseCurrentPane { confirm = true } 
    },
    -- New workspace
    {
        key    = "w",
        mods   = "LEADER",
        action = wezterm.action.PromptInputLine {
            description = "Enter workspace name",
            action = wezterm.action_callback(function(window, pane, line)
                if line then
                    window:perform_action(
                        wezterm.action.SwitchToWorkspace {
                            name = line,
                        },
                        pane
                    )
                end
            end),
        },
    },
    -- List workspaces
    {
        key    = "s",
        mods   = "LEADER",
        action = wezterm.action.ShowLauncherArgs { flags = "FUZZY|WORKSPACES" },
    },
    -- Rename workspaces
    {
        key = 'R',
        mods = 'CTRL|SHIFT',
        action = wezterm.action.PromptInputLine {
            description = 'Rename workspace',
            action = wezterm.action_callback(function(window, pane, line)
                if line then
                    wezterm.mux.rename_workspace(
                        wezterm.mux.get_active_workspace(),
                        line
                    )
                end
            end),
        },
    },
    -- TMUX type of server behavior 
    {
        key = "a",
        mods = "LEADER",  -- Leader + Shift + A to attach
        action = action.AttachDomain("unix"),
    },
    {
        key = "d",
        mods = "LEADER",
        action = action.DetachDomain({ DomainName = "unix" }),
    },
    -- Check domains information
    {
        key    = "i",
        mods   = "LEADER",
        action = wezterm.action_callback(function(window, pane)
            local domain = pane:get_domain_name()
            window:perform_action(wezterm.action.EmitEvent "show-domain", pane)
            wezterm.log_info("Current domain: " .. domain)
        end),
    },
    -- Debugging
    { 
        key    = "D",
        mods   = "CTRL|SHIFT",
        action = wezterm.action.ShowDebugOverlay,
    },
}

for i = 1, 9 do
    table.insert(config.keys, {
        key    = tostring(i),
        mods   = "LEADER",
        action = action.ActivateTab(i - 1),
    })
end

return config

Expected Behavior

No response

Logs

No response

Anything else?

No response

acampove avatar Nov 10 '25 04:11 acampove

Hi,

It seems that this mux server that I am trying to use as a replacement of TMUX is the problem.

Image

I will disable it and keep using tmux. But there is for sure a memory leak there.

Cheers.

acampove avatar Nov 11 '25 01:11 acampove

Further update, I see that It is not possible to dissable this mux server. I also see that others have raised this issue for instance here but I do not see any constructive discussion there.

Just in case there is still any doubt about the existence of a leak, I know that the terminal is using 12 Gb of memory because my laptop suddently freezes and slows down. I am not tracking constantly the memory usage of any program, but I will start digging if my expensive laptop with 42 GB of memory suddenly cannot cope.

In any case, I do not have time to keep digging into this, I have an actual job and I will just install a different terminal emulator

Cheers.

acampove avatar Nov 11 '25 02:11 acampove

I’ve experienced this with it before as well, not sure what causes it. I didn’t even have a config, it was barebones and would jump to 18gb on my 16gb MacBook Air, so I’d be 10gb into swap.

SpencerPresley avatar Nov 23 '25 15:11 SpencerPresley