#!/bin/sh
cat > /tmp/$$
new=`cat /tmp/$$ | grep -c ' new'`
destroy=`cat /tmp/$$ | grep -c ' destroy'`
ref=`cat /tmp/$$ | grep -c ' ref'`
unref=`cat /tmp/$$ | grep -c ' unref'`

if [ $new != $destroy ];then
  echo new/destroy imbalance of `expr $destroy - $new`
fi

if [ $ref != $unref ];then
  echo ref/unref imbalance of `expr $unref - $ref`
fi

rm -f /tmp/$$
