linuxdeepin / developer-center

Deepin developer center, provide developer wiki and community forum.
450 stars 73 forks source link

deepin-wm eats too much RAM #140

Closed avently closed 7 years ago

avently commented 7 years ago

After one hour after reboot system uses 1.5 GB of RAM. I closed all my apps except geary and made a screenshot. Take a look. As you can see deepin-wm has two much memory (915 MB). If i just closes it memory looks better - 897MB used (~200 MB for deepin-wm). screenshot Can you fix it? Because 4 GB is not a good choice for Manjaro Deepin... I use Manjaro Deepin 16.10.3 and default kernel. Also i tried to limit number of desktops via this property - com.deepin.wrap.gnome.desktop.wm.preferences num-workspaces 2 - but looks like it can not help with RAM issue.

sonald commented 7 years ago

I never experience any memory problem. after several days of using (without logout), the memory usage is predicable and reasonable. this may be caused by some corner case. paste your xrandr output. what is your video card ?

avently commented 7 years ago

Screen 0: minimum 8 x 8, current 1600 x 900, maximum 16384 x 16384 VGA-0 disconnected (normal left inverted right x axis y axis) LVDS-0 connected primary 1600x900+0+0 (normal left inverted right x axis y axis) 382mm x 215mm 1600x900 59.98*+ HDMI-0 disconnected (normal left inverted right x axis y axis) Nvidea 410M

avently commented 7 years ago

I closed all other windows and here is the result. I should kill this application tens times in a day.

screenshot

avently commented 7 years ago

can someone answer me what can i do? How can i help you to fix this issue? Maybe you already did or find a fix?

sonald commented 7 years ago

Can you try to run deepin-wm with valgrind to locate the memory leak ? I never receive such huge memleak before? how many windows did you open ?

avently commented 7 years ago

i can run it, but please tell what command i should run. This is a log for valgrind --leak-check=full deepin-wm --replace valgrind.txt

P.S. I open usually 5 apps maximum. Only 2-3 apps works in backgroud as a daemons. On this screenshot only background apps works - no foreground apps (except terminal of course)

sonald commented 7 years ago

Sorry, I forgot to mention that for this to work, you should first kill deepin-wm-switcher by killdeepin-wm-switcher, and then runvalgrind --tool=memcheck deepin-wm --replace`

avently commented 7 years ago

This is the results. valgrind.txt

sonald commented 7 years ago

I can not found any special info. the most probable leak source is from your nvidia proprietary driver.

avently commented 7 years ago

Oh, you are right. I removed Nvidia driver, then rebooted. I started 10 apps (Android Studio, Chromium and Gitkraken included) + 3 daemons. Only 3 GB of RAM is used (1.9 GB without Android Studio). Deepin-wm use <80 MB (~50 MB after restart). Its awesome. Thank you, @sonald ! So, as i understand, i can not use Nvidia driver... Or can i use Nvidia driver only for games and Nouveau for everything else? Is it real?

felixonmars commented 7 years ago

You may try some legacy branch of the driver, like 340xx. I never experienced this problem with the latest nvidia driver, though :/

aedancullen commented 6 years ago

The same problem still exists in DDE 15.5.1 with the latest NVIDIA driver 396 on newer GPUs. On Lenovo ThinkPad P50 (Quadro M1000M), this occurs with BIOS set to discrete-only graphics mode.

I can confirm that switching wallpapers consistently increases deepin-wm RAM usage. It should be interesting to see if the same memory leak exists on desktop systems, or if it is somehow specific to Optimus laptops running in discrete-only mode (which I assume was @avently's configuration). Possibly it is related to deepin-wm not playing nicely with the driver's GL libraries?

aedancullen commented 6 years ago

Actually, a similar thing is occurring even with no NVIDIA driver on the system at all (only i915, with Intel graphics running). Repeatedly opening and closing large numbers of workspaces in Multitasking Mode causes memory to leak, although possibly at a slower rate than with NVIDIA. After opening/closing maybe about 30-40 workspaces, deepin-wm is already larger than 200MB.

sonald commented 6 years ago

valgrind indicates the leak may reside into cogl layer. that is hard to debug and fix.