Hello. This bug is a continuation of previous attempts (bug #16314) to improve the long-term memory consumption of xfdesktop. When the user is changing workspaces and all the workspaces look the same, xfdesktop will unnecessarily call backdrop_changed_cb which leads to memory allocations and which due to memory fragmentation increases xfdesktop's memory consumption (RES in top/htop). A patch fixing this issue will be added to this bug report in a few minutes.
Created attachment 9815 Patch in git format This patch reduces memory consumption on a 4K display by about 33 MB when switching workspaces. Longer-term memory consumption can be reduced by up to 85 MB (with a 4K display). As a side-effect, xfdesktop is now consuming about 1-3 ms of CPU time per workspace switch. Previously, it was consuming about 15-30 ms. Please review this patch and test whether it reduces memory consumption as advertised.
I can't reproduce the leak with my setup (HD + Full HD displays), xfdesktop starts at about 75MB and after switching multiple times between three workspaces (each with a different wallpaper) it goes to 118~126MB, I couldn't see any difference with or without your patch.
By the way, I'm inclined to merge it, since it caused no regressions and seems to make sense, but being able to reproduce feels safer :)
(In reply to Andre Miranda from comment #2) > I can't reproduce the leak with my setup (HD + Full HD displays), xfdesktop > starts at about 75MB and after switching multiple times between three > workspaces (each with a different wallpaper) it goes to 118~126MB, I > couldn't see any difference with or without your patch. I forgot to mention that the patch applies only to the case of having a single wallpaper on all workspaces. In the case of multiple wallpapers, the current_workspace variable isn't a constant/invariant.
Jan Ziak referenced this bugreport in commit 481fbfd95b2bec9378556d42c7c3e88676381679 Avoid redundant calls to backdrop_changed_cb (Bug #16773) https://gitlab.xfce.org/xfce/xfdesktop/commit/481fbfd95b2bec9378556d42c7c3e88676381679
With single wallpaper the memory consumption doesn't increase while switching workspaces, thanks!