Been dealing with a slow, gradual memory leak and I'm not sure how to figure out what is causing it

System:
  Kernel: 6.9.12-x64v-xanmod1-1 arch: x86_64 bits: 64 compiler: gcc v: 14.1.1
    clocksource: tsc avail: hpet,acpi_pm
    parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-xanmod
    root=UUID=30342c7e-f5f2-4539-b072-b8c3e5701d39 rw rootflags=subvol=@
    quiet loglevel=3 ibt=off
  Desktop: GNOME v: 46.4 tk: GTK v: 3.24.43 wm: gnome-shell
    tools: gsd-screensaver-proxy dm: 1: GDM v: 46.2 note: stopped 2: SDDM
    Distro: Garuda base: Arch Linux
Machine:
  Type: Desktop Mobo: ASRock model: B550 Phantom Gaming 4/ac serial: <filter>
    uuid: 7059a1a8-f454-0000-0000-000000000000 UEFI: American Megatrends LLC.
    v: P2.20 date: 02/24/2022
CPU:
  Info: model: AMD Ryzen 7 5800X socket: AM4 bits: 64 type: MT MCP
    arch: Zen 3+ gen: 4 level: v3 note: check built: 2022 process: TSMC n6 (7nm)
    family: 0x19 (25) model-id: 0x21 (33) stepping: 0 microcode: 0xA201016
  Topology: cpus: 1x cores: 8 tpc: 2 threads: 16 smt: enabled cache:
    L1: 512 KiB desc: d-8x32 KiB; i-8x32 KiB L2: 4 MiB desc: 8x512 KiB
    L3: 32 MiB desc: 1x32 MiB
  Speed (MHz): avg: 3800 min/max: 2200/4850 boost: enabled
    base/boost: 3800/4850 scaling: driver: acpi-cpufreq governor: performance
    volts: 1.1 V ext-clock: 100 MHz cores: 1: 3800 2: 3800 3: 3800 4: 3800
    5: 3800 6: 3800 7: 3800 8: 3800 9: 3800 10: 3800 11: 3800 12: 3800
    13: 3800 14: 3800 15: 3800 16: 3800 bogomips: 121372
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
  Vulnerabilities: <filter>
Graphics:
  Device-1: NVIDIA GA104 [GeForce RTX 3070 Ti] vendor: Micro-Star MSI
    driver: nvidia v: 555.58.02 alternate: nvidiafb,nouveau,nvidia_drm
    non-free: 550.xx+ status: current (as of 2024-06; EOL~2026-12-xx)
    arch: Ampere code: GAxxx process: TSMC n7 (7nm) built: 2020-2023 pcie:
    gen: 1 speed: 2.5 GT/s lanes: 16 link-max: gen: 4 speed: 16 GT/s ports:
    active: none off: DP-1,HDMI-A-1 empty: DP-2,DP-3 bus-ID: 06:00.0
    chip-ID: 10de:2482 class-ID: 0300
  Device-2: Microdia Dual Mode Camera (8006 VGA) driver: hid-generic,usbhid
    type: USB rev: 2.0 speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 5-1:2
    chip-ID: 0c45:8006 class-ID: 0301
  Display: unspecified server: X.Org v: 21.1.13 with: Xwayland v: 24.1.1
    compositor: gnome-shell driver: X: loaded: nvidia unloaded: modesetting
    alternate: fbdev,nouveau,nv,vesa gpu: nvidia,nvidia-nvswitch
    display-ID: :0 screens: 1
  Screen-1: 0 s-res: 3520x1159 s-dpi: 96 s-size: 931x307mm (36.65x12.09")
    s-diag: 980mm (38.59")
  Monitor-1: DP-0 pos: primary,top-left res: 1920x1080 dpi: 90
    size: 543x302mm (21.38x11.89") diag: 621mm (24.46") modes: N/A
  Monitor-2: HDMI-0 pos: bottom-r res: 1600x900 hz: 60 dpi: 94
    size: 432x240mm (17.01x9.45") diag: 494mm (19.46") modes: N/A
  API: EGL v: 1.5 hw: drv: nvidia platforms: device: 0 drv: nvidia device: 2
    drv: swrast surfaceless: drv: nvidia x11: drv: nvidia
    inactive: gbm,wayland,device-1
  API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: nvidia mesa v: 555.58.02
    glx-v: 1.4 direct-render: yes renderer: NVIDIA GeForce RTX 3070 Ti/PCIe/SSE2
    memory: 7.81 GiB
  API: Vulkan v: 1.3.279 layers: 1 device: 0 type: discrete-gpu name: NVIDIA
    GeForce RTX 3070 Ti driver: nvidia v: 555.58.02 device-ID: 10de:2482
    surfaces: xcb,xlib
Audio:
  Device-1: NVIDIA GA104 High Definition Audio vendor: Micro-Star MSI
    driver: snd_hda_intel v: kernel pcie: gen: 4 speed: 16 GT/s lanes: 16
    bus-ID: 06:00.1 chip-ID: 10de:228b class-ID: 0403
  Device-2: AMD Starship/Matisse HD Audio vendor: ASRock
    driver: snd_hda_intel v: kernel pcie: gen: 4 speed: 16 GT/s lanes: 16
    bus-ID: 08:00.4 chip-ID: 1022:1487 class-ID: 0403
  Device-3: Fifine Microphone driver: hid-generic,snd-usb-audio,usbhid
    type: USB rev: 1.1 speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 5-4:3
    chip-ID: 3142:5060 class-ID: 0300
  API: ALSA v: k6.9.12-x64v-xanmod1-1 status: kernel-api with: aoss
    type: oss-emulator tools: alsactl,alsamixer,amixer
  Server-1: PipeWire v: 1.2.2 status: n/a (root, process) with:
    1: pipewire-pulse status: active 2: wireplumber status: active
    3: pipewire-alsa type: plugin 4: pw-jack type: plugin
    tools: pactl,pw-cat,pw-cli,wpctl
Network:
  Device-1: Realtek RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet
    vendor: ASRock driver: r8169 v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 1
    port: f000 bus-ID: 04:00.0 chip-ID: 10ec:8168 class-ID: 0200
  IF: enp4s0 state: down mac: <filter>
  Device-2: Intel Dual Band Wireless-AC 3168NGW [Stone Peak] driver: iwlwifi
    v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 1 bus-ID: 05:00.0
    chip-ID: 8086:24fb class-ID: 0280
  IF: wlp5s0 state: up mac: <filter>
  IF-ID-1: tailscale0 state: unknown speed: -1 duplex: full mac: N/A
  Info: services: NetworkManager, systemd-timesyncd, wpa_supplicant
Bluetooth:
  Device-1: Realtek Bluetooth Radio driver: btusb v: 0.8 type: USB rev: 1.1
    speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 1-5.1:6 chip-ID: 0bda:8771
    class-ID: e001 serial: <filter>
  Report: btmgmt ID: hci0 rfk-id: 0 state: up address: <filter> bt-v: 5.1
    lmp-v: 10 status: discoverable: no pairing: no class-ID: 6c0104
  Device-2: Intel Wireless-AC 3168 Bluetooth driver: btusb v: 0.8 type: USB
    rev: 2.0 speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 1-9:7 chip-ID: 8087:0aa7
    class-ID: e001
  Report: ID: hci1 rfk-id: 1 state: up address: <filter> bt-v: 4.2 lmp-v: 8
    status: discoverable: no pairing: no class-ID: 6c0104
Drives:
  Local Storage: total: 4.55 TiB used: 2.46 TiB (54.2%)
  SMART Message: Required tool smartctl not installed. Check --recommends
  ID-1: /dev/sda maj-min: 8:0 vendor: Western Digital
    model: WD10EZEX-00BBHA0 size: 931.51 GiB block-size: physical: 4096 B
    logical: 512 B speed: 6.0 Gb/s tech: HDD rpm: 7200 serial: <filter>
    fw-rev: 1A01 scheme: GPT
  ID-2: /dev/sdb maj-min: 8:16 vendor: Samsung model: SSD 870 QVO 4TB
    size: 3.64 TiB block-size: physical: 512 B logical: 512 B speed: 6.0 Gb/s
    tech: SSD serial: <filter> fw-rev: 2B6Q scheme: GPT
Partition:
  ID-1: / raw-size: 1.2 TiB size: 1.2 TiB (100.00%) used: 825.41 GiB (67.3%)
    fs: btrfs block-size: 4096 B dev: /dev/sdb5 maj-min: 8:21
  ID-2: /boot/efi raw-size: 100 MiB size: 96 MiB (96.00%)
    used: 28.1 MiB (29.2%) fs: vfat block-size: 512 B dev: /dev/sdb1
    maj-min: 8:17
  ID-3: /home raw-size: 1.2 TiB size: 1.2 TiB (100.00%)
    used: 825.41 GiB (67.3%) fs: btrfs block-size: 4096 B dev: /dev/sdb5
    maj-min: 8:21
  ID-4: /var/log raw-size: 1.2 TiB size: 1.2 TiB (100.00%)
    used: 825.41 GiB (67.3%) fs: btrfs block-size: 4096 B dev: /dev/sdb5
    maj-min: 8:21
  ID-5: /var/tmp raw-size: 1.2 TiB size: 1.2 TiB (100.00%)
    used: 825.41 GiB (67.3%) fs: btrfs block-size: 4096 B dev: /dev/sdb5
    maj-min: 8:21
Swap:
  Kernel: swappiness: 133 (default 60) cache-pressure: 50 (default 100)
    zswap: no
  ID-1: swap-1 type: zram size: 31.27 GiB used: 2.24 GiB (7.2%)
    priority: 100 comp: zstd avail: lzo,lzo-rle,lz4,lz4hc,842 max-streams: 16
    dev: /dev/zram0
Sensors:
  System Temperatures: cpu: 51.1 C mobo: N/A gpu: nvidia temp: 59 C
  Fan Speeds (rpm): N/A gpu: nvidia fan: 0%
Info:
  Memory: total: 32 GiB available: 31.27 GiB used: 13.06 GiB (41.8%)
  Processes: 519 Power: uptime: 4d 9h 28m states: freeze,mem,disk
    suspend: deep avail: s2idle wakeups: 0 hibernate: platform avail: shutdown,
    reboot, suspend, test_resume image: 12.45 GiB services: gsd-power,
    power-profiles-daemon, upowerd Init: systemd v: 256 default: graphical
    tool: systemctl
  Packages: 1952 pm: pacman pkgs: 1864 libs: 538
    tools: octopi,pacseek,paru,trizen pm: flatpak pkgs: 88 Compilers:
    clang: 18.1.8 gcc: 14.2.1 Shell: garuda-inxi (sudo) default: fish v: 3.7.1
    running-in: gnome-terminal inxi: 3.3.35
Garuda (2.6.26-1):
  System install date:     2024-08-06
  Last full system update: 2024-08-07 ↻
  Is partially upgraded:   No
  Relevant software:       snapper NetworkManager dracut nvidia-dkms
  Windows dual boot:       Yes
  Failed units:            logrotate.service pamac-cleancache.service

I tried looking this up and people were saying it might have something to do with certain GNOME extensions, so here’s my list of those:

  • AATWS
  • AppIndicator and KStatusNotifierItem Support
  • ArcMenu
  • Bluetooth Quick Connect
  • ClipQR
  • Custom Reboot
  • Dash to Panel
  • Emoji Copy
  • Media Progress
  • Mock tray
  • Mount Meter
  • Net speed Simplified
  • Notification Counter
  • OpenWeather Refined
  • PiP on top
  • ram_sens (what I am using to see the gradual memory usage increase over time)
  • Run Android Emulators
  • Screenshot Tool
  • Tailscale Status
  • Tiling Assistant
  • TwitchLive Panel (disabled)
  • Wifi QR Code
  • Window Is Ready - Notification Remover

What are some commands/tools I can use to try to diagnose why this is happening?

Maybe you could try disabling them all and enabling back one by one when you have a certain degree of assurance that there is no memory leak.
When you see the leak again you’ll have probably found the guilty extension.

6 Likes

Uninstalled most of them, but I need ones like the AppIndicators for megasync-instances to work properly. I installed Heaptrack, hopefully I will be able to diagnose the leaks in a couple hours, I will update then

Did it begin recently?

Check your Pacman logs for any software installed around the same time this issue began. It could be any new software (or update) responsible for the leak.

Have you searched online for recent gnome bug reports?

Good luck with your sleuthing. :male_detective:

4 Likes

Actually it has been going on for a while. I’ve just always been lazy about finding a solution for it since I could always reset it by logging out and back in again

Edit - Yeah I have gone through the GNOME bug reports, etc, as well. Nothing stood out to me :confused:

You seem to know what a memory leak is.
Would you mind defining

  • memory leak
  • slow, gradual memory leak
  • the difference between the above
  • how do you diagnose it (tools, commands, etc.)

It would help to be on the same page, and maybe find our own memory leaks (apart from human memory leaks :rofl: I certainly have).

1 Like

Have you noticed this^^^

I would definitely check your logs for continuously repeated error messages, and also the space your logs are consuming.

4 Likes

I use the ram_sens extension to check ram usage at any given time. It displays current ram usage, updating at 5 second intervals. What I noticed was that I could leave my PC on for a few hours and that percentage goes from like ~30% to 40+% without much input. That’s what I mean by gradual

In most cases all I have is a Floorp window, spotify, and discord running

As for actually diagnosing, I am looking at heaptrack outputs. No idea if that will get me far though

Looking into this right now

logrotate.service
I ran sudo systemctl status logrotate.service and got the output:

logrotate.service - Rotate log files
     Loaded: loaded (/usr/lib/systemd/system/logrotate.service; static)
     Active: failed (Result: exit-code) since Wed 2024-08-07 00:16:06 CDT; 21h ago
 Invocation: c6ca1b3c647143eaa3b1a8994445a155
TriggeredBy: â—Ź logrotate.timer
       Docs: man:logrotate(8)
             man:logrotate.conf(5)
   Main PID: 3374058 (code=exited, status=1/FAILURE)
   Mem peak: 2M
        CPU: 25ms

Aug 07 00:16:06 crypti1c-b550phantomgaming4ac systemd[1]: Starting Rotate log files...
Aug 07 00:16:06 crypti1c-b550phantomgaming4ac logrotate[3374058]: error: stat of /var/log/wtmp failed: No such file or directory
Aug 07 00:16:06 crypti1c-b550phantomgaming4ac systemd[1]: logrotate.service: Main process exited, code=exited, status=1/FAILURE
Aug 07 00:16:06 crypti1c-b550phantomgaming4ac systemd[1]: logrotate.service: Failed with result 'exit-code'.
Aug 07 00:16:06 crypti1c-b550phantomgaming4ac systemd[1]: Failed to start Rotate log files.

Created the file myself and now it seems to be working fine now

pamac-cleancache.service
I think this is where insisting on staying on pamac-flatpak is coming back to bite…

Output of sudo systemctl status pamac-cleancache.service:

pamac-cleancache.service - Clean packages cache
     Loaded: loaded (/usr/lib/systemd/system/pamac-cleancache.service; static)
     Active: failed (Result: exit-code) since Sat 2024-08-03 15:00:04 CDT; 4 days ago
 Invocation: 6dba1b6d9bd1400eae49a8521bb0d4cf
TriggeredBy: â—Ź pamac-cleancache.timer
   Main PID: 539860 (code=exited, status=203/EXEC)
   Mem peak: 1.5M
        CPU: 2ms

Checked /usr/lib/systemd/system/pamac-cleancache.service and found that in the line ExecStart=/usr/bin/pamac clean --no-confirm, /usr/bin/pamac is a file that does not exist on my system. The following packages were there though: pamac-checkupdates, pamac-daemon, pamac-installer, pamac-manager, pamac-tray

I consulted with my (not so) trustworthy companion ChatGPT and tried using /usr/bin/pamac-installer, which failed. The next suggestion was to instead use ExecStart=/usr/bin/paccache -r, which did work

After restarting the service and running a followup sudo systemctl status pamac-cleancache.service, all seems to be fine for the moment. A followup garuda-inxi shows no failed units either

1 Like

That doesn’t necessarily indicate an issue. It’s probably just ordinary disk caching.

https://www.linuxatemyram.com/

In general, Linux will leave pages in the cache until another application needs that memory, because why not (“unused RAM is wasted RAM”).

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.