xmonad / xmonad-contrib

Contributed modules for xmonad

Home Page:https://xmonad.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CPU usage is higer than once (Could it may be a memory leak?)

thealio opened this issue · comments

Hi
I've noticed that the CPU usage of my xmonad session seems higer than once
I noticed this opening my leftwm session recently.
I have the same configuration on both , same startups etc.
Opening only htop on alacritty , (plus of course the starups , and polybar on both) it seems that my xmonad session uses 10-11% of CPU , while leftwm only 0,7-1%

I'd like to know if there is sorta like of memory leak on the latest releases, or if you guys had noticed something similar, and if possible memory leak were recently investigated , and if not I require a check about that.

I'm on Arch , I have xmonad + xmonad-contrib + xmonad -extras installed

I haven't noticed any changes personally, but then I don't really have a habit of keeping xmonad running for more than a few days at a time (e.g., my current uptime is 2 days and some hours, while CPU usage (and, more important for this, memory usage) sits comfortably at 0% (resp. 0.2%).

If you think there is a problem, profiling XMonad as was done in #653 should certainly reveal it.

I haven't noticed any changes personally, but then I don't really have a habit of keeping xmonad running for more than a few days at a time (e.g., my current uptime is 2 days and some hours, while CPU usage (and, more important for this, memory usage) sits comfortably at 0% (resp. 0.2%).

If you think there is a problem, profiling XMonad as was done in #653 should certainly reveal it.

Hi,
I figure out what caused the higher memory usage

I used xmonad + polybar.


xmonad $ ewmh $ docks $ ewmhFullscreen $ pagerHints $ myDefaults
-- $ pagerHints is required for print the current layout in xmonad ( xprop -root _XMONAD_CURRENT_LAYOUT | awk '{print $NF}' | tr -d "\"" )

On polybar, I wrote a custum module that shows the current layout on the bar . The module is the following:

[module/xmonad-layout]
type = custom/script
format-prefix = " "
format-foreground = ${colors.color07}
format-background = ${colors.color00}
exec = xprop -root _XMONAD_CURRENT_LAYOUT | awk '{print $NF}' | tr -d "\""
tail = true

It extract the layout with xprop -root _XMONAD_CURRENT_LAYOUT | awk '{print $NF}' | tr -d "\""

It seems that this caused the unusual high CPU consumption , I don't know exactly why this happens.

How often is it running? If it's spawning it for every update, it could be running quite often and spawning shells constantly.

How often is it running? If it's spawning it for every update, it could be running quite often and spawning shells constantly.

every time switch layout it runs for sure, I don't know if actually it never-ending runs in the background.
I don't know if there is a way to stop after every run

Seems very much like something you should ask the polybar people

Seems very much like something you should ask the polybar people

Thank you for your support, I've already reported to the polybar team.

However , I'll report the code I've modify that fix the issue, for completeness

[module/xmonad-layout]
type = custom/script
format-prefix = " "
format-foreground = ${colors.color07}
format-background = ${colors.color00}
exec = xprop -root _XMONAD_CURRENT_LAYOUT | awk '{print $NF}' | tr -d "\""
; tail shoud be commented or turned off, to avoid CPU high usage
; tail = true
 interval = 1