ksh/leak2.sh

47 lines
743 B
Bash

#!/usr/bin/ksh
foo=0
LoopCountForMEMSAP=0
bla=234
typeset -lui count=4000
typeset -lui leak=0
vm()
{
typeset size
typeset key unit result=""
while read key size unit; do
case "$key" in
VmSize*) result=${result:+"$result:"}$size ;;
VmRSS*) result=${result:+"$result:"}$size ;;
VmData*) result=${result:+"$result:"}$size ;;
esac
done < /proc/$$/status
echo $result
}
fusub()
{
datun=`date +%S`
# datun=$(date +%S)
interval=$((10 - datun%10))
}
curstate="XXXX:XXXX:XXXX"
oldstate=$(vm)
while ((count-- > 0))
do
foo=$((foo+1))
datum=`fusub`
# datum=$(fusub)
curstate=$(vm)
[ "$curstate" != "$oldstate" ] && let leak++
oldstate="$curstate"
done
echo "[${0##*/}: leak count at $leak]"
((leak < 8)) || exit 1