-pid=$$
-
-# Warm up
-unset t
-t=111111111111111111111111111111111111111111111111111111111111111111111111
-export t
-unset t
-t=111111111111111111111111111111111111111111111111111111111111111111111111
-export t
-unset t
-t=111111111111111111111111111111111111111111111111111111111111111111111111
-export t
-unset t
-t=111111111111111111111111111111111111111111111111111111111111111111111111
-export t
-unset t
-t=111111111111111111111111111111111111111111111111111111111111111111111111
-export t
-i=1
-if test $i = 1111111111111111111111111111111111111111111111; then i=2; fi
-beg=`ps -o pid,vsz | grep "^ *$pid "`
-
echo "Measuring memory leak..."
-beg=`ps -o pid,vsz | grep "^ *$pid "`
i=1
while test $i != X; do
unset t
if test $i = 111111111111111111111111111111111111111111111h; then i=i; fi
if test $i = 111111111111111111111111111111111111111111111i; then i=j; fi
if test $i = 111111111111111111111111111111111111111111111j; then i=X; fi
+ memleak
done
-end=`ps -o pid,vsz | grep "^ *$pid "`
-
-if test "$beg" != "$end"; then
- echo "vsz grows: $beg -> $end"
+memleak
+kb=$?
+if test $kb -le 4; then
+ echo Ok
else
- echo "vsz does not grow"
+ echo "Bad: $kb kb (or more) leaked"
fi