pop-os / cosmic-applets

WIP applets for cosmic-panel
GNU General Public License v3.0
217 stars 89 forks source link

[bug] Every cosmic-applet in use is consuming 300 Mb of RAM memory. #723

Open ljfp opened 2 weeks ago

ljfp commented 2 weeks ago

Cosmic-applets version: 0.1.0~1731341110~22.04~09062c1

Specific applet that this is regarding (if applicable): all of them

Issue/Bug description: each applet is consuming 300 Mb of memory

Steps to reproduce: use htop, btop, or a similar program to check RAM usage of comic-applets

Expected behavior: their sizes should be ~100 times smaller.

Other notes: I am using Pop!_OS 22.04 LTS x86_64 and Linux kernel 6.9.3-76060903-generic

Are these release builds compiled with -C prefer-dynamic and -C strip=symbols flags to reduce the binary size? Maybe that could help.

screenshot-2024-11-14-16-48-45

ids1024 commented 2 weeks ago

Could you post the output of https://github.com/pixelb/ps_mem? That may be a little more useful than a screenshot of htop.

I do see memory usage reported that's about 100x smaller than that. Though even using multiple megabytes per applet may mean there's room for improvement.

ljfp commented 2 weeks ago

@ids1024 Sure, here it is:

 Private  +   Shared  =  RAM used   Program

148.0 KiB +  15.5 KiB   = 163.5 KiB fusermount3
244.0 KiB +  16.5 KiB   = 260.5 KiB acpid
292.0 KiB +  38.5 KiB   = 330.5 KiB cron
372.0 KiB +  51.5 KiB   = 423.5 KiB rtkit-daemon
628.0 KiB + 115.5 KiB  = 743.5 KiB  switcheroo-control
652.0 KiB +  98.5 KiB   = 750.5 KiB xdg-permission-store
788.0 KiB + 110.5 KiB  = 898.5 KiB  gvfs-mtp-volume-monitor
836.0 KiB +  98.5 KiB   = 934.5 KiB dconf-service
872.0 KiB + 152.5 KiB  =   1.0 MiB  at-spi2-registryd
880.0 KiB + 148.5 KiB  =   1.0 MiB  at-spi-bus-launcher
560.0 KiB + 524.0 KiB  =   1.1 MiB  avahi-daemon (2)
680.0 KiB + 410.5 KiB  =   1.1 MiB  master
924.0 KiB + 208.5 KiB  =   1.1 MiB  gvfsd-fuse
868.0 KiB + 306.5 KiB  =   1.1 MiB  dbus
  1.0 MiB + 191.5 KiB   =   1.2 MiB gvfs-goa-volume-monitor
  1.1 MiB + 112.5 KiB   =   1.2 MiB gvfsd-metadata
668.0 KiB + 585.5 KiB =   1.2 MiB   pickup
  1.1 MiB + 188.5 KiB =   1.2 MiB   gvfsd
720.0 KiB + 583.5 KiB =   1.3 MiB   qmgr
  1.2 MiB + 131.5 KiB =   1.3 MiB   accounts-daemon
  1.1 MiB + 196.5 KiB =   1.3 MiB   xdg-document-portal
  1.2 MiB + 124.5 KiB =   1.3 MiB   gvfs-gphoto2-volume-monitor
  1.2 MiB + 275.5 KiB =   1.5 MiB   gvfs-afc-volume-monitor
  1.2 MiB + 282.0 KiB =   1.5 MiB   agent (2)
  1.6 MiB +  62.5 KiB  =   1.7 MiB  bluetoothd
  1.5 MiB + 585.5 KiB =   2.0 MiB   systemd-logind
708.0 KiB +   1.4 MiB =   2.1 MiB   sudo (2)
  1.9 MiB + 275.5 KiB =   2.2 MiB   upowerd
  1.8 MiB + 499.5 KiB =   2.3 MiB   dbus-broker-launch (3)
  2.1 MiB + 530.5 KiB =   2.6 MiB   gvfs-udisks2-volume-monitor
  2.0 MiB + 565.5 KiB =   2.6 MiB   cups-browsed
  2.5 MiB + 131.5 KiB =   2.6 MiB   rsyslogd
  2.4 MiB + 430.5 KiB =   2.8 MiB   gnome-keyring-daemon
  2.4 MiB + 396.5 KiB =   2.8 MiB   pipewire-pulse
  2.3 MiB + 917.5 KiB =   3.2 MiB   goa-identity-service
  3.2 MiB + 174.5 KiB =   3.3 MiB   polkitd
  3.0 MiB + 571.5 KiB =   3.5 MiB   cupsd
  3.8 MiB + 102.5 KiB =   3.9 MiB   systemd-udevd
  3.3 MiB + 678.5 KiB =   3.9 MiB   xdg-desktop-portal
  4.0 MiB + 282.5 KiB =   4.2 MiB   dbus-broker (3)
  4.4 MiB +  22.5 KiB  =   4.4 MiB  cosmic-idle
  4.5 MiB +  67.5 KiB  =   4.5 MiB  system76-power
  4.4 MiB + 471.5 KiB =   4.9 MiB   colord
  4.9 MiB +  58.5 KiB  =   4.9 MiB  cosmic-greeter-daemon
  4.0 MiB + 976.0 KiB =   5.0 MiB   chronyd (2)
  3.5 MiB +   1.5 MiB  =   5.0 MiB  greetd (2)
  4.5 MiB + 652.5 KiB =   5.1 MiB   ModemManager
  4.4 MiB + 701.5 KiB =   5.1 MiB   udisksd
  5.2 MiB +  18.5 KiB  =   5.2 MiB  cosmic-session
  5.2 MiB +  37.5 KiB  =   5.3 MiB  cosmic-settings-daemon
  4.1 MiB +   1.8 MiB  =   5.9 MiB  touchegg (2)
  4.3 MiB +   1.6 MiB  =   5.9 MiB  packagekitd
  5.3 MiB + 772.5 KiB =   6.1 MiB   systemd-resolved
  5.4 MiB + 805.5 KiB =   6.2 MiB   wpa_supplicant
  5.2 MiB +   1.2 MiB  =   6.3 MiB  pipewire
  6.8 MiB + 100.5 KiB =   6.9 MiB   bash
  7.2 MiB + 837.5 KiB =   8.0 MiB   NetworkManager
  4.1 MiB +   4.3 MiB  =   8.4 MiB  pop-system-updater (2)
  7.5 MiB +   1.3 MiB  =   8.8 MiB  wireplumber
  5.6 MiB +   3.8 MiB  =   9.4 MiB  evolution-addressbook-factory
  9.3 MiB + 588.5 KiB =   9.8 MiB   systemd-journald
  5.8 MiB +   4.6 MiB =  10.4 MiB   system76-scheduler (2)
  8.2 MiB +   2.3 MiB =  10.5 MiB   xdg-desktop-portal-gtk
  9.4 MiB +   1.3 MiB =  10.7 MiB   networkd-dispat
  5.7 MiB +   5.0 MiB =  10.7 MiB   systemd (3)
 11.1 MiB + 364.5 KiB =  11.5 MiB   cosmic-osd
 13.0 MiB + 952.5 KiB =  14.0 MiB   geoclue
 14.0 MiB +  53.5 KiB =  14.1 MiB   cosmic-greeter
 11.3 MiB +   4.7 MiB =  16.0 MiB   pop-launcher (3)
 14.7 MiB +   1.4 MiB =  16.1 MiB   xdg-desktop-portal-gnome
 13.9 MiB +   2.9 MiB =  16.9 MiB   evolution-source-registry
 14.8 MiB +   2.2 MiB =  17.0 MiB   applet.py
 20.9 MiB +   1.7 MiB =  22.6 MiB   fwupd
 19.7 MiB +   3.2 MiB =  22.9 MiB   nm-applet
 30.5 MiB +  51.5 KiB =  30.6 MiB   snapd
 26.2 MiB +   5.6 MiB =  31.8 MiB   evolution-calendar-factory
 20.9 MiB +  12.4 MiB =  33.3 MiB   evolution-alarm-notify
 31.7 MiB +   9.6 MiB =  41.3 MiB   Xwayland
 41.0 MiB + 844.5 KiB =  41.8 MiB   tor
 27.0 MiB +  15.8 MiB =  42.9 MiB   cosmic-bg
 42.2 MiB +   8.4 MiB =  50.5 MiB   cosmic-workspaces
 45.0 MiB +  10.2 MiB =  55.3 MiB   cosmic-panel
 52.3 MiB +   8.2 MiB =  60.5 MiB   goa-daemon
 90.8 MiB +   2.6 MiB =  93.4 MiB   python3.10
159.9 MiB + 958.5 KiB = 160.8 MiB   execsnoop-bpfcc
159.0 MiB +   3.6 MiB = 162.6 MiB   cosmic-notifications
162.6 MiB +   5.7 MiB = 168.3 MiB   cosmic-applet-m
162.6 MiB +   6.0 MiB = 168.6 MiB   cosmic-applet-w
162.8 MiB +   5.8 MiB = 168.6 MiB   cosmic-applet-i
167.5 MiB +   3.7 MiB = 171.1 MiB   cosmic-launcher
169.4 MiB +   6.0 MiB = 175.4 MiB   cosmic-applet-a
172.6 MiB +   5.9 MiB = 178.4 MiB   cosmic-applet-p
172.7 MiB +   6.1 MiB = 178.8 MiB   cosmic-applet-s
170.4 MiB +   9.1 MiB = 179.5 MiB   xdg-desktop-portal-cosmic
183.8 MiB +  12.0 MiB = 195.7 MiB   cosmic-app-library
194.7 MiB +  12.1 MiB = 206.8 MiB   cosmic-files-applet
198.9 MiB +  29.6 MiB = 228.5 MiB   cosmic-comp
228.3 MiB +  12.2 MiB = 240.5 MiB   cosmic-term
332.4 MiB +  11.8 MiB = 344.2 MiB   cosmic-applet-t (2)
337.9 MiB +  12.5 MiB = 350.4 MiB   cosmic-app-list (2)
339.2 MiB +  11.7 MiB = 350.8 MiB   cosmic-applet-n (2)
339.6 MiB +  11.7 MiB = 351.3 MiB   cosmic-applet-b (2)
847.5 MiB +  28.7 MiB = 876.2 MiB   cosmic-panel-bu (5)
---------------------------------
                          5.6 GiB
=================================

Those are the results of ps_mem after a fresh start. Later today I'll paste the results of ps_mem after a couple of hours running, to see if there's a big difference.

wiiznokes commented 2 weeks ago

I wonder what's causing this. Personally, i'm on latest commits and memory consumption seems reasonable

 36.3 MiB +   2.4 MiB =  38.6 MiB       cosmic-applet-p
 37.3 MiB +   2.5 MiB =  39.8 MiB       cosmic-applet-a
 38.4 MiB +   2.3 MiB =  40.7 MiB       cosmic-applet-b
 39.4 MiB +   2.3 MiB =  41.6 MiB       cosmic-panel-bu
 43.7 MiB +   2.5 MiB =  46.2 MiB       cosmic-app-list
 46.0 MiB +   4.8 MiB =  50.8 MiB       cosmic-panel
 52.5 MiB +   7.1 MiB =  59.6 MiB       cosmic-bg
 57.7 MiB +   8.2 MiB =  65.9 MiB       cosmic-workspaces
 66.9 MiB +   5.1 MiB =  72.0 MiB       cosmic-applet-t (2)
 65.8 MiB +   8.4 MiB =  74.1 MiB       cosmic-app-library
 74.0 MiB +   4.7 MiB =  78.7 MiB       cosmic-applet-n (2)
 81.2 MiB +   4.8 MiB =  85.9 MiB       Xwayland
 62.5 MiB +  25.8 MiB =  88.3 MiB       konsole
 81.1 MiB +  12.4 MiB =  93.5 MiB       gnome-system-monitor
 95.8 MiB +   8.6 MiB = 104.5 MiB       cosmic-files-applet
 91.1 MiB +  25.7 MiB = 116.8 MiB       cosmic-comp
ids1024 commented 2 weeks ago

Those numbers look a bit high too, comparing to a recently started session on my system (with 3 monitors).

Looks like a memory leak somewhere.

  4.0 KiB +  56.5 KiB =  60.5 KiB   cosmic-greeter-daemon
  3.4 MiB +  19.5 KiB =   3.5 MiB   cosmic-settings-daemon
  2.2 MiB +   2.1 MiB =   4.3 MiB   cosmic-applet-p (3)
  2.8 MiB +   2.3 MiB =   5.0 MiB   cosmic-applet-i (3)
  3.1 MiB +   2.1 MiB =   5.2 MiB   cosmic-applet-m (3)
  3.8 MiB +   2.7 MiB =   6.5 MiB   cosmic-applet-n (3)
  4.2 MiB +   3.4 MiB =   7.6 MiB   cosmic-applet-w (3)
  6.0 MiB +   2.3 MiB =   8.4 MiB   cosmic-applet-b (3)
  8.1 MiB + 379.5 KiB =   8.5 MiB   cosmic-launcher
  6.1 MiB +   2.7 MiB =   8.8 MiB   cosmic-applet-a (3)
 12.0 MiB +   5.3 MiB =  17.4 MiB   cosmic-applet-t (6)
 15.2 MiB +   5.0 MiB =  20.3 MiB   cosmic-panel [updated]
 18.6 MiB +   4.3 MiB =  22.9 MiB   cosmic-app-list (3)
 26.9 MiB +   5.5 MiB =  32.4 MiB   cosmic-applet-s (3)
 71.3 MiB +  49.2 MiB = 120.5 MiB   cosmic-bg
 92.2 MiB +  83.3 MiB = 175.5 MiB   cosmic-comp (2)
163.3 MiB +  47.5 MiB = 210.9 MiB   cosmic-term (6)
211.8 MiB +   3.3 MiB = 215.1 MiB   cosmic-greeter
joshuamegnauth54 commented 1 week ago

Related recent issues: