Xfce Forum

Sub domains
 

You are not logged in.

#1 2018-07-25 05:23:40

saski
Member
Registered: 2018-05-31
Posts: 19

Memory issue with Conky feh background faking on workspace switch

Hi there,

I'm using fake transparency for conky (compositing disabled) with the feh tool. to track workspace switches I use a bash script which works fine however it seems that it produces memory leaks of some sort. after a couple of hrs several GiB of memory is being consumed:

#!/bin/bash

# make sure that only one instance of this script is running per user
lockfile=/tmp/.wchg.$USER.lockfile
if ( set -o noclobber; echo "locked" > "$lockfile") 2> /dev/null; then
   trap 'rm -f "$lockfile"; exit $?' INT TERM EXIT
   echo "wsp_notifyDEBUG: Locking succeeded" >&2

   CURRENT_WORKSPACE=$(wmctrl -d | grep \* | cut -d' ' -f1)
   while true
   do
      sleep 1
      NEW_WORKSPACE=$(wmctrl -d | grep \* | cut -d' ' -f1)
      if [ $CURRENT_WORKSPACE -ne $NEW_WORKSPACE ]; then 
         #echo "A workspace change has occurred. $CURRENT_WORKSPACE -> $NEW_WORKSPACE"
         #feh --bg-center /root/wallpapers/03886_paintedplains_1920x1080.jpg
         feh --bg-center --xinerama-index 0 /root/wallpapers/autumn-landscape-with-trees-1920x1080-wallpaper-11341.jpg
         CURRENT_WORKSPACE=$NEW_WORKSPACE
      fi
   done

# can't create lockfile - notify user and quit
else
   echo "wsp_notifyDEBUG: Lock failed, check for existing process and/or lock file and delete - exiting." >&2
   exit 1
fi			

exit 0

Any idea what could cause this? Or maybe is there a smarter way to do this?

Regards

Offline

#2 2018-07-25 11:02:11

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,492

Re: Memory issue with Conky feh background faking on workspace switch

Your script is a little odd. On every workspace change it just runs feh and loads the same wallpaper. Why not just set that wallpaper and not use the script at all? The effect would be the same.

I use the same  bash script but instead of the feh command, I use notify-send to send a notification about workspace change. I don't have any memory leaks with this set up.

Can you manually run that feh command repeatedly (outside of the script) and see if it generates a memory leak?

#!/bin/bash
while true
do
   feh --bg-center --xinerama-index 0 /root/wallpapers/autumn-landscape-with-trees-1920x1080-wallpaper-11341.jpg
sleep 1
done

Also, replace the feh command in your script with:

notify-send "Workspace" "$NEW_WORKSPACE"

...and see if that generates a memory leak. It would help identify where the leak is coming from.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2018-07-25 12:21:26

saski
Member
Registered: 2018-05-31
Posts: 19

Re: Memory issue with Conky feh background faking on workspace switch

The increasing memory consumption is shown by conky right after switching the workspace. I can call feh for as much as I like nothing changes as long as I stay on the same workspace. So when the script calls feh AFTER a workspace switch to load the background image I see a jump between 10 and 20 MBytes every time I switch the workspace again. When I call my script without feh and put the notify-send command I see some fluctuations in memory usage but no steady increase. top or htop doesn't reveal any application that consumes the memory. Also when I run feh in a loop as you suggested I too see the same increase on workspace switch - as if Xfce puts the background somewhere in memory. sad

Offline

#4 2018-07-25 12:41:43

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,492

Re: Memory issue with Conky feh background faking on workspace switch

What versions of xfdesktop and xfwm are you running?

Have you tried using xfdesktop for wallpaper management instead of feh? Does it generate a memory leak as well?


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#5 2018-07-25 13:37:53

Misko_2083
Member
Registered: 2015-10-13
Posts: 211
Website

Re: Memory issue with Conky feh background faking on workspace switch

Probably a feh related memory leak.
Maybe qiv behaves better.
It's in Debian repos.
The command would be:

qiv --xineramascreen 0 --root '/root/wallpapers/autumn-landscape-with-trees-1920x1080-wallpaper-11341.jpg'

Do you want to exit the Circus?
https://www.youtube.com/watch?v=ZJwQicZHp_c

Offline

#6 2018-07-25 14:54:06

saski
Member
Registered: 2018-05-31
Posts: 19

Re: Memory issue with Conky feh background faking on workspace switch

I'm currently on Gentoo with:

xfce-base/xfdesktop-4.13.2::gentoo  USE="libnotify thunar -debug" 

Also setting some new background images with the Desktop settings dialog doesn't seem to permamtly consume memory.

I also gave the qiv tool a shot but it seems that qiv doesn't scale the selected background to screensize instead it tries to fit the image into conky's window. conky is running on the right lover edge of my left(primary) screen and the background in conky doesn't align. I tried some parameters but no success. Any ideas?

Thanks for all your tips and suggestions so far smile

Offline

#7 2018-07-25 16:16:35

Misko_2083
Member
Registered: 2015-10-13
Posts: 211
Website

Re: Memory issue with Conky feh background faking on workspace switch

Have you tried with --maxpect?

man qiv
    -m, --maxpect
              Expand  image(s)  to  fit  screen  size  while preserving aspect
              ratio.

The full command would be:

qiv --xineramascreen 0 --maxpext --root '/root/wallpapers/autumn-landscape-with-trees-1920x1080-wallpaper-11341.jpg'

For some reason qiv draws only behind conky.

If I set the centered background with feh

feh --bg-center --xinerama-index 0 /root/wallpapers/autumn-landscape-with-trees-1920x1080-wallpaper-11341.jpg

this fits with conky:

qiv --xineramascreen 0 --root '/root/wallpapers/autumn-landscape-with-trees-1920x1080-wallpaper-11341.jpg'

If I set it to fill:

feh --bg-fill--xinerama-index 0 /root/wallpapers/autumn-landscape-with-trees-1920x1080-wallpaper-11341.jpg

qiv with maxpect option fits it.

qiv --xineramascreen 0 --maxpext --root '/root/wallpapers/autumn-landscape-with-trees-1920x1080-wallpaper-11341.jpg'

The trick seems to be to find the right combination. smile

By the way this is my image (4.5MB - JPG 3840 x 2160 pixels): https://www.deviantart.com/misko-2083/a … -725527770. I used it with the code above.

Last edited by Misko_2083 (2018-07-25 16:24:32)


Do you want to exit the Circus?
https://www.youtube.com/watch?v=ZJwQicZHp_c

Offline

#8 2018-07-28 12:11:13

saski
Member
Registered: 2018-05-31
Posts: 19

Re: Memory issue with Conky feh background faking on workspace switch

Ok I've tried feh quiv and even the Eterm tool all showing the same results after 8 hrs and a couple of hundred workspace switches. conky shows at least 3GiB memory overhead even if tmpfs is clean and all applications are closed. from what I can observe with the free command is that it seems to be shared memory that is bloatet up.

ipcs -m

shows several segments but I cannot make out why there is so many shared memory being allocated and from what. Any idea what I can do to bisect this further? Maybe open a bug or asking the developers for help?

regards

Offline

#9 2018-07-30 11:27:33

Misko_2083
Member
Registered: 2015-10-13
Posts: 211
Website

Re: Memory issue with Conky feh background faking on workspace switch

Try this:

watch "ps --sort -rss -eo pid,pmem,rss,vsz,comm | head -16"

and change wallpaper with feh.
Every 5-6 times I change wallpaper with feh, xorg leaks memory.


Do you want to exit the Circus?
https://www.youtube.com/watch?v=ZJwQicZHp_c

Offline

#10 2018-07-30 18:45:11

saski
Member
Registered: 2018-05-31
Posts: 19

Re: Memory issue with Conky feh background faking on workspace switch

Misko_2083 wrote:

Try this:

watch "ps --sort -rss -eo pid,pmem,rss,vsz,comm | head -16"

and change wallpaper with feh.
Every 5-6 times I change wallpaper with feh, xorg leaks memory.

Yes I can see this too. This is not supposed to happen, right? Did you file a bug for this? Question is if this is xorg related or xfdesktop?

Offline

#11 2018-08-13 17:27:32

Misko_2083
Member
Registered: 2015-10-13
Posts: 211
Website

Re: Memory issue with Conky feh background faking on workspace switch

saski wrote:

Yes I can see this too. This is not supposed to happen, right? Did you file a bug for this? Question is if this is xorg related or xfdesktop?

Sorry, I can't figure out what is the cause.

Instead of feh you could change the wallpaper with xfconf-query https://forum.xfce.org/viewtopic.php?id=10894


Do you want to exit the Circus?
https://www.youtube.com/watch?v=ZJwQicZHp_c

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.010 seconds, 7 queries executed - Memory usage: 589.09 KiB (Peak: 605.93 KiB) ]