A Script takes more and more memory and CPU

Hi!

Please can you look on my skript, whats going wrong with it. This Applet is swallowed in my FvwmButton and shows me the state of my UMTS-modem, my external HD and the status of the Backup on this HD (HD is busy with backup or not), and the state of fetchmail and fetchnews. It also changes the Title of the Button in FvwmButton for the Volume-Control, so that i have always the right volume in it.

This applet works fine. But it takes more and more memory and cpu. after 4, 5 hours top shows me, that it needs 30% mem, and the same cpu-time… but i cannot find a variable or a loop, which counts up and is not beeing reset…

ps auxf shows nor further process after the process for this script!

The script:

WindowTitle {FvwmApplet-kppp}
WindowSize 60 16
Font “Shadow=0 1 SE:xft:Bitstream Dejavu Sans Mono:style=Roman:size=6”
#Font --lucida-bold-r-normal--10------

Use the FvwmScript default colors.

BackColor {#c6c3c6}
#ForeColor {black}
#ShadowColor {black}
#HilightColor {rgb:a0/90/80}

Init
Begin
Set $MainColorset=(GetScriptArgument 1)
If $MainColorset <> {} Then
Begin
ChangeColorset 0 $MainColorset
ChangeColorset 1 $MainColorset
ChangeColorset 2 $MainColorset
ChangeColorset 3 $MainColorset
End
ChangeIcon 1 status_off.png

ChangeIcon 3 choice-no.png

Set $mars = 0
Set $ppp = 0
Set $umts = 0
Set $rsnap = 0
Set $pidoffnews = 0
Set $pidoffmail = 0
Set $fmail = 0
Set $fetchstat = 0
Set $volume_set = 0
Set $mute_set = “”
End

PeriodicTasks
Begin
If (RemainderOfDiv (GetTime) 1)==0 Then
Begin
Set $pidoffnews = 0
Set $pidoffmail = 0
Set $fmail = 0
Set $fetchstat = 0
Set $umts = (GetOutput {test -e /dev/umts0 && echo 1 || echo 0} 1 1)
Set $ppp = (GetOutput {test -e /var/run/ppp0.pid && echo 1 || echo 0} 1 1)
Set $mars = (GetOutput {test -e /dev/disk/mars && echo 1 || echo 0} 1 1)
Set $rsnap = (GetOutput {test -e /var/run/rsnapshot.pid && echo 1 || echo 0} 1 1)
Set $pidoffnews = (GetOutput {/bin/pidof fetchnews} 1 1)
Set $pidoffmail = (GetOutput {/bin/pidof fetchmail} 1 1)
Set $volume = (GetOutput {amixer sget Master|grep “%”|sed -e ‘s/^.[([0-9])%.$/\1/g’} 1 1)
Set $mute = (GetOutput {amixer sget Master|grep “%”|sed -e 's/^.
(on|off).*$/\1/g’} 1 1)
If $pidoffmail <> {} Then
Set $fmail = (GetOutput {grep SigIgn /proc/$(pidof fetchmail)/status|cut -c 22} 1 1)

Do {echo } $volume { } $mute

If $pidoffnews <> {} Then
Set $fnews = 1
Else
Begin
Set $fnews = 0
End

If (Add $fnews $fmail) > 0 Then
Set $fstat = 1
Else
Begin
Set $fstat = 0
End

Do {exec echo } $fstat { } $fnews { } $fmail { } $pidoffnews { } $pidoffmail { } $umts { } $ppp { } $mars { } $rsnap { } $volume { } $mute

If $umts == 1 Then
Begin
If $ppp == 1 Then
ChangeIcon 1 kppp-establ.png
Else
Begin
ChangeIcon 1 kppp-ready.png
End
End
Else
Begin
ChangeIcon 1 kppp-notready.png
End
If $mars == 1 Then
Begin
If $rsnap == 1 Then
ChangeIcon 2 disk-achtung.xpm
Else
Begin
ChangeIcon 2 disk-on.xpm
End
End
Else
Begin
ChangeIcon 2 disk-off.xpm
End
End
If $fstat == 1 Then
ChangeIcon 3 fetch-off.png
Else
Begin
ChangeIcon 3 fetch-on.png
End
#ChangeTitle 3 $fnews
If $volume_set == $volume Then
Set $chvol = 0
Else
Begin
Set $chvol = 1
Set $volume_set = $volume
End

If $mute_set == $mute Then
Set $chmute = 0
Else
Begin
Set $chvol =1
Set $chmute = 1
Set $mute_set = $mute

Set $tit = “Mute”

End

If $mute == on Then
Begin
If $chvol == 1 Then
Begin
If $volume == 0 Then
Do {CHANGE_ICON Vol audio-volume-muted.png}
If $volume > 0 Then
Do {CHANGE_ICON Vol audio-volume-low.png}
If $volume >= 33 Then
Do {CHANGE_ICON Vol audio-volume-medium.png}
If $volume >= 66 Then
Do {CHANGE_ICON Vol audio-volume-high.png}
Do {CHANGE_TITLE Vol Volume (} $volume {%)}
End
End
Else
Begin
If $chmute == 1 Then
Do {CHANGE_ICON Vol audio-volume-muted.png}

Do {CHANGE_TITLE Vol (} $volume $mute {%)}

End

End

Widget 1

status von ppp/umts

Property
Position 2 0
Size 16 16
Type ItemDraw
Flags NoReliefString

Title {orange|orange}

Icon kppp-notready.png
Main
Case message of
SingleClic :
Begin
Do {Function PPPconnect}
End
End

Widget 2
#status von rsnapshot
Property
Position 22 0
Size 16 16
Type ItemDraw
Flags NoReliefString

Title {""|mount-mars|umount-mars}

Icon disk.xpm
Main
Case message of
SingleClic :
Begin
If $rsnap == 1 Then
Do {Function KillMkBackUp}
Else
Do {Function StartMkBackUp}
End
End

Widget 3
#status von fetchnews
Property
Position 42 0
Size 16 16
Type ItemDraw

Type PushButton

Flags NoReliefString

Title {“1”|“mount-mars”|“umount-mars”}

Icon status_on.png
Main
Case message of
SingleClic :
Begin
Do FetchMailNews
End
End

Hi!

I tested now a lot, and i found out, that the Problem ist the support of xpm-pictures/icons.
When i convert this icons from xpm to png from the following part of the script, there is no more consumption of memory…

do you konw something about this problem?

Works fine for me.

I suspect this to be a problem in your version of libxpm.

– Thomas Adam

please can you compare?

$ dpkg -l|grep xpm
ii fvwm-icons 20070101-1 icon *.xpm files from fvwm development site
ii libgd2-xpm 2.0.36~rc1~dfsg-6 GD Graphics Library version 2
ii libxpm4 1:3.5.9-4 X11 pixmap library

Jakob