#!/usr/bin/ksh PATH=/bin:/usr/bin:/usr/sbin:/sbin getSampleInterval() { return 0; } typeset -ilu times=4000 typeset -ilu 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 } curstate="XXXX:XXXX:XXXX" oldstate=$(vm) while ((times-- > 0)) do interval=$(getSampleInterval) curstate=$(vm) [ "$curstate" != "$oldstate" ] && let leak++ oldstate="$curstate" done echo "[${0##*/}: leak count at $leak]" ((leak < 7)) || exit 1