hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
21.22k stars 895 forks source link

Huge memory usage due to emacs child-frame #7038

Closed jilen closed 3 months ago

jilen commented 3 months ago

Regression?

No

System Info and Version

System/Version info ```sh Hyprland, built from branch main at commit 4beac91cbd791657cc53d6e483eb41bf4df1ec0c (keybinds: add safeguard to mousebinds (7034)). Date: Thu Jul 25 06:19:15 2024 Tag: v0.41.2-94-g4beac91c, commits: 4980 flags: (if any) System Information: System name: Linux Node name: jilen.moe Release: 6.10.0-arch1-2 Version: #1 SMP PREEMPT_DYNAMIC Mon, 22 Jul 2024 17:28:23 +0000 GPU information: 2b:00.0 VGA compatible controller [0300]: NVIDIA Corporation TU116 [GeForce GTX 1660 SUPER] [10de:21c4] (rev a1) (prog-if 00 [VGA controller]) NVRM version: NVIDIA UNIX Open Kernel Module for x86_64 555.58.02 Release Build (archlinux-builder@) os-release: NAME="Arch Linux" PRETTY_NAME="Arch Linux" ID=arch BUILD_ID=rolling ANSI_COLOR="38;2;23;147;209" HOME_URL="https://archlinux.org/" DOCUMENTATION_URL="https://wiki.archlinux.org/" SUPPORT_URL="https://bbs.archlinux.org/" BUG_REPORT_URL="https://gitlab.archlinux.org/groups/archlinux/-/issues" PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/" LOGO=archlinux-logo plugins: ======Config-Start====== Config File: $HOME/.config/hypr/hyprland.conf: Read Succeeded # This file sources other files in `hyprland` and `custom` folders # You wanna add your stuff in file in `custom` # Defaults source=~/.config/hypr/hyprland/env.conf source=~/.config/hypr/hyprland/execs.conf source=~/.config/hypr/hyprland/general.conf source=~/.config/hypr/hyprland/rules.conf source=~/.config/hypr/hyprland/colors.conf source=~/.config/hypr/hyprland/keybinds.conf Config File: $HOME/.config/hypr/hyprland/env.conf: Read Succeeded # ######### Input method ########## # See https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland env = QT_IM_MODULE, fcitx env = XMODIFIERS, @im=fcitx # env = GTK_IM_MODULE, wayland # Crashes electron apps in xwayland env = GTK_IM_MODULE, fcitx # My Gtk apps no longer require this to work with fcitx5 hmm env = SDL_IM_MODULE, fcitx env = GLFW_IM_MODULE, fcitx env = INPUT_METHOD, fcitx # ############ Themes ############# env = QT_QPA_PLATFORM, wayland env = QT_QPA_PLATFORMTHEME, qt6ct env = QT_AUTO_SCREEN_SCALE_FACTOR,1 # env = QT_STYLE_OVERRIDE,kvantum # env = WLR_NO_HARDWARE_CURSORS, 1 # ######## Screen tearing ######### # env = WLR_DRM_NO_ATOMIC, 1 # ############ Others ############# env = LIBVA_DRIVER_NAME,nvidia env = XDG_SESSION_TYPE,wayland env = GBM_BACKEND,nvidia-drm env = __GLX_VENDOR_LIBRARY_NAME,nvidias env = XCURSOR_SIZE, 24 Config File: $HOME/.config/hypr/hyprland/execs.conf: Read Succeeded # Bar, wallpaper exec-once = ags & # Input method exec-once = fcitx5 # Core components (authentication, lock screen, notification daemon) exec-once = gnome-keyring-daemon --start --components=secrets exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 || /usr/libexec/polkit-gnome-authentication-agent-1 exec-once = hypridle exec-once = dbus-update-activation-environment --all exec-once = sleep 1 && dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP # Some fix idk exec-once = hyprpm reload # Clipboard: history # exec-once = wl-paste --watch cliphist store & exec-once = wl-paste --type text --watch cliphist store exec-once = wl-paste --type image --watch cliphist store # Merge xresource(xft) exec-once = xrdb -merge ~/.Xresources Config File: $HOME/.config/hypr/hyprland/general.conf: Read Succeeded # MONITOR CONFIG monitor=,preferred,auto,auto # monitor=,addreserved, 0, 0, 0, 0 # Custom reserved area # HDMI port: mirror display. To see device name, use `hyprctl monitors` # monitor=HDMI-A-1,1920x1080@60,1920x0,1,mirror,eDP-1 input { # Keyboard: Add a layout and uncomment kb_options for Win+Space switching shortcut kb_layout = us # kb_options = grp:win_space_toggle numlock_by_default = true repeat_delay = 250 repeat_rate = 35 touchpad { natural_scroll = yes disable_while_typing = true clickfinger_behavior = true scroll_factor = 0.5 } special_fallthrough = true follow_mouse = 1 kb_options = ctrl:nocaps } binds { # focus_window_on_workspace_c# For Auto-run stuff see execs.confhange = true scroll_event_delay = 0 } gestures { workspace_swipe = true workspace_swipe_distance = 700 workspace_swipe_fingers = 4 workspace_swipe_cancel_ratio = 0.2 workspace_swipe_min_speed_to_force = 5 workspace_swipe_direction_lock = true workspace_swipe_direction_lock_threshold = 10 workspace_swipe_create_new = true } general { # Gaps and border gaps_in = 4 gaps_out = 5 gaps_workspaces = 50 border_size = 1 # Fallback colors col.active_border = rgba(0DB7D4FF) col.inactive_border = rgba(31313600) resize_on_border = true no_focus_fallback = true layout = dwindle #focus_to_other_workspaces = true # ahhhh i still haven't properly implemented this allow_tearing = true # This just allows the `immediate` window rule to work } dwindle { preserve_split = true # no_gaps_when_only = 1 smart_split = false smart_resizing = false } decoration { rounding = 20 blur { enabled = true xray = true special = false new_optimizations = true size = 14 passes = 4 brightness = 1 noise = 0.01 contrast = 1 popups = true popups_ignorealpha = 0.6 } # Shadow drop_shadow = true shadow_ignore_window = true shadow_range = 20 shadow_offset = 0 2 shadow_render_power = 4 col.shadow = rgba(0000002A) # Shader # screen_shader = ~/.config/hypr/shaders/nothing.frag # screen_shader = ~/.config/hypr/shaders/vibrance.frag # Dim dim_inactive = false dim_strength = 0.1 dim_special = 0 } animations { enabled = true # Animation curves bezier = linear, 0, 0, 1, 1 bezier = md3_standard, 0.2, 0, 0, 1 bezier = md3_decel, 0.05, 0.7, 0.1, 1 bezier = md3_accel, 0.3, 0, 0.8, 0.15 bezier = overshot, 0.05, 0.9, 0.1, 1.1 bezier = crazyshot, 0.1, 1.5, 0.76, 0.92 bezier = hyprnostretch, 0.05, 0.9, 0.1, 1.0 bezier = menu_decel, 0.1, 1, 0, 1 bezier = menu_accel, 0.38, 0.04, 1, 0.07 bezier = easeInOutCirc, 0.85, 0, 0.15, 1 bezier = easeOutCirc, 0, 0.55, 0.45, 1 bezier = easeOutExpo, 0.16, 1, 0.3, 1 bezier = softAcDecel, 0.26, 0.26, 0.15, 1 bezier = md2, 0.4, 0, 0.2, 1 # use with .2s duration # Animation configs animation = windows, 1, 3, md3_decel, popin 60% animation = windowsIn, 1, 3, md3_decel, popin 60% animation = windowsOut, 1, 3, md3_accel, popin 60% animation = border, 1, 10, default animation = fade, 1, 3, md3_decel # animation = layers, 1, 2, md3_decel, slide animation = layersIn, 1, 3, menu_decel, slide animation = layersOut, 1, 1.6, menu_accel animation = fadeLayersIn, 1, 2, menu_decel animation = fadeLayersOut, 1, 4.5, menu_accel animation = workspaces, 1, 7, menu_decel, slide # animation = workspaces, 1, 2.5, softAcDecel, slide # animation = workspaces, 1, 7, menu_decel, slidefade 15% # animation = specialWorkspace, 1, 3, md3_decel, slidefadevert 15% animation = specialWorkspace, 1, 3, md3_decel, slidevert } misc { vfr = 1 vrr = 1 # layers_hog_mouse_focus = true force_default_wallpaper = 2 focus_on_activate = true animate_manual_resizes = false animate_mouse_windowdragging = false enable_swallow = false swallow_regex = (foot|kitty|Alacritty) disable_hyprland_logo = false new_window_takes_over_fullscreen = 2 allow_session_lock_restore = true initial_workspace_tracking = false } # Overview plugin { hyprexpo { columns = 3 gap_size = 5 bg_col = rgb(000000) workspace_method = first 1 # [center/first] [workspace] e.g. first 1 or center m+1 enable_gesture = false # laptop touchpad, 4 fingers gesture_distance = 300 # how far is the "max" gesture_positive = false } } xwayland { force_zero_scaling = true } cursor { no_hardware_cursors = true } Config File: $HOME/.config/hypr/hyprland/rules.conf: Read Succeeded # ######## Window rules ######## # Apps windowrulev2 = tile, title:^(微信|wechat.exe)$ windowrulev2 = workspace 4, title:^(微信|wechat.exe)$ windowrulev2 = tile, class:^(wechat-devtools)$ windowrule = noblur,.* # windowrule = opacity 0.89 override 0.89 override, .* # Applies transparency to EVERY WINDOW windowrulev2 = tile, class:(dev.warp.Warp) windowrulev2 = float, title:^([Pp]icture[-\s]?[Ii]n[-\s]?[Pp]icture)(.*)$ # Dialogs windowrulev2 = float, title:(选择文件夹|打开|图片查看) windowrulev2 = center, title:(选择文件夹|打开|图片查看) windowrulev2 = size 50% 50%, title:(选择文件夹|图片查看) # Tearing windowrule=immediate,.*\.exe windowrulev2=immediate,class:(steam_app) # No shadow for tiled windows windowrulev2 = noshadow,floating:0 # ######## Layer rules ######## layerrule = xray 1, .* # layerrule = noanim, .* layerrule = noanim, walker layerrule = noanim, selection layerrule = noanim, overview layerrule = noanim, anyrun layerrule = noanim, indicator.* layerrule = noanim, osk layerrule = noanim, hyprpicker layerrule = blur, shell:* layerrule = ignorealpha 0.6, shell:* layerrule = noanim, noanim layerrule = blur, gtk-layer-shell layerrule = ignorezero, gtk-layer-shell layerrule = blur, launcher layerrule = ignorealpha 0.5, launcher layerrule = blur, notifications layerrule = ignorealpha 0.69, notifications # ags layerrule = animation slide top, sideleft.* layerrule = animation slide top, sideright.* layerrule = blur, session layerrule = blur, bar layerrule = ignorealpha 0.6, bar layerrule = blur, corner.* layerrule = ignorealpha 0.6, corner.* layerrule = blur, dock layerrule = ignorealpha 0.6, dock layerrule = blur, indicator.* layerrule = ignorealpha 0.6, indicator.* layerrule = blur, overview layerrule = ignorealpha 0.6, overview layerrule = blur, cheatsheet layerrule = ignorealpha 0.6, cheatsheet layerrule = blur, sideright layerrule = ignorealpha 0.6, sideright layerrule = blur, sideleft layerrule = ignorealpha 0.6, sideleft layerrule = blur, indicator* layerrule = ignorealpha 0.6, indicator* layerrule = blur, osk layerrule = ignorealpha 0.6, osk Config File: $HOME/.config/hypr/hyprland/colors.conf: Read Succeeded # exec = export SLURP_ARGS='-d -c FFDAD4BB -b 673B3444 -s 00000000' general { col.active_border = rgba(F7DCDE39) col.inactive_border = rgba(A58A8D30) } misc { background_color = rgba(1D1011FF) } plugin { hyprbars { # Honestly idk if it works like css, but well, why not bar_text_font = Rubik, Geist, AR One Sans, Reddit Sans, Inter, Roboto, Ubuntu, Noto Sans, sans-serif bar_height = 30 bar_padding = 10 bar_button_padding = 5 bar_precedence_over_border = true bar_part_of_window = true bar_color = rgba(1D1011FF) col.text = rgba(F7DCDEFF) # example buttons (R -> L) # hyprbars-button = color, size, on-click hyprbars-button = rgb(F7DCDE), 13, 󰖭, hyprctl dispatch killactive hyprbars-button = rgb(F7DCDE), 13, 󰖯, hyprctl dispatch fullscreen 1 hyprbars-button = rgb(F7DCDE), 13, 󰖰, hyprctl dispatch movetoworkspacesilent special } } windowrulev2 = bordercolor rgba(FFB2BCAA) rgba(FFB2BC77),pinned:1 Config File: $HOME/.config/hypr/hyprland/keybinds.conf: Read Succeeded $terminal = alacritty $fileManager = nautilus $menu = fuzzel $mainMod = SUPER bind = $mainMod SHIFT, Left, movewindow, l bind = $mainMod SHIFT, Right, movewindow, r bind = $mainMod SHIFT, Up, movewindow, u bind = $mainMod SHIFT, Down, movewindow, d bind = $mainMod SHIFT, P, exec, grim -g "$(slurp)" bind = $mainMod, P, exec, grim # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more bind = $mainMod, Q, exec, $terminal bind = $mainMod, M, exit, bind = $mainMod, E, exec, $fileManager bind = $mainMod, R, exec, $menu bind = $mainMod, J, togglesplit # dwindle bind = $mainMod, K, killactive # Move focus with mainMod + arrow keys bind = $mainMod, left, movefocus, l bind = $mainMod, right, movefocus, r bind = $mainMod, up, movefocus, u bind = $mainMod, down, movefocus, d # Switch workspaces with mainMod + [0-9] bind = $mainMod, 1, workspace, 1 bind = $mainMod, 2, workspace, 2 bind = $mainMod, 3, workspace, 3 bind = $mainMod, 4, workspace, 4 bind = $mainMod, 5, workspace, 5 bind = $mainMod, 6, workspace, 6 bind = $mainMod, 7, workspace, 7 bind = $mainMod, 8, workspace, 8 bind = $mainMod, 9, workspace, 9 bind = $mainMod, 0, workspace, 10 # Move active window to a workspace with mainMod + SHIFT + [0-9] bind = $mainMod SHIFT, 1, movetoworkspace, 1 bind = $mainMod SHIFT, 2, movetoworkspace, 2 bind = $mainMod SHIFT, 3, movetoworkspace, 3 bind = $mainMod SHIFT, 4, movetoworkspace, 4 bind = $mainMod SHIFT, 5, movetoworkspace, 5 bind = $mainMod SHIFT, 6, movetoworkspace, 6 bind = $mainMod SHIFT, 7, movetoworkspace, 7 bind = $mainMod SHIFT, 8, movetoworkspace, 8 bind = $mainMod SHIFT, 9, movetoworkspace, 9 bind = $mainMod SHIFT, 0, movetoworkspace, 10 # Example special workspace (scratchpad) bind = $mainMod, S, togglespecialworkspace, magic bind = $mainMod SHIFT, S, movetoworkspace, special:magic # Scroll through existing workspaces with mainMod + scroll bind = $mainMod, mouse_down, workspace, e+1 bind = $mainMod, mouse_up, workspace, e-1 ======Config-End======== ```

Description

Memory usage increased to 12GB and workspace freeze.

How to reproduce

Not sure how to reproduce this, but the freeze is observed after using firefox for some while.

Crash reports, logs, images, videos

No response

vaxerski commented 3 months ago

ram or vram? Anyways if this is not reproducible it might be impossible to track down. Also see #6885

jilen commented 3 months ago

It is 100% reproducible on my pc. Slowly increasing memory usage observed here.

output of ps -p $pid -o %cpu,%mem,cmd

[18:02:04]
%CPU %MEM CMD
19.7  7.6 Hyprland

[18:03:04]
%CPU %MEM CMD
19.9  7.5 Hyprland

[18:04:04]
%CPU %MEM CMD
20.2 11.3 Hyprland

[18:05:04]
%CPU %MEM CMD
20.6 11.3 Hyprland

[18:06:04]
%CPU %MEM CMD
20.8 11.7 Hyprland

[18:07:04]
%CPU %MEM CMD
21.0 13.3 Hyprland
vaxerski commented 3 months ago

is it reproducible on the default config? I can't seem to repro and you seem to be the only one affected.

Is this a regression? It seems easily bisectable if it is, considering you get such a sharp memory increase within minutes.

jilen commented 3 months ago

@vaxerski I might find the cause of the huge memory usage. It is mainly due to emacs child-frame. Tons of child-frames will be open for common use case (such as auto-completion). Seems hyprland will not release resource caused by this type of windows(child-frame).

vaxerski commented 3 months ago

can you test latest git?

Also, is emacs running in native wayland? If so, can you pass a WAYLAND_DEBUG=1 log?

jilen commented 3 months ago

@vaxerski Yes I am on the latest git. And emacs is run in native wayland. emacs-wayland.log

vaxerski commented 3 months ago

this is the same as #6885 and not a hl bug

idlip commented 3 months ago

Hi!

I also faced this issue recently, did try with emacs -Q (no config), then too it persists.

I was not sure if its hyprland or emacs issue. I used emacs-overlay (latest 31.0.50), nixos with hyprland from unstable.

Finally someone pointed it out, and was addressed.

For any debugging, hope I can add up or be a help!

Also, for emacs, i was killing the daemon and restarting, in this hassle I discovered activities.el git, which can save sessions and window config using bookmark feature in emacs.

Thank you vaxry, for always being quick and working on this!

vaxerski commented 2 months ago

this should be reported to emacs (possibly gtk) as a leak

jilen commented 2 months ago

Hm, emacs on xwayland works just fine.

jilen commented 2 months ago

There's a fix on https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/7206/diffs I tried that patch, no leaks any more.

vaxerski commented 2 months ago

told ya

jilen commented 2 months ago

Made an aur build script with that patch, https://github.com/jilen/gtk-fixed In case of someone may need it.

idlip commented 2 months ago

Yay! The fix is merged!

Thank you jilen for investigating and nudging for the push in gitlab!

thyeun commented 2 days ago

emacs-wayland 29.4-3 (from arch repos) still having huge memory usage

And when launching emacs, will feel laggy.

241025_02h31m57s_screenshot