8 if [ "$(uname -s)" = "Darwin" ] ; then
9 echo "leaks check on $name ($pid)"
10 leaks
-exclude __CFInitialize
$pid > leaks-log
2>&1 || \
11 { echo "leaks failed: $?"; cat leaks-log
; exit 1; }
14 perl
-e 'my $excluded = 0; my $num = -1; while (<>) {
15 if (/Process $ENV{pid}: (\d+) leaks for \d+ total leaked bytes/) { $num = $1;}
16 if (/(\d+) leaks excluded/) { $excluded = $1;}
18 exit 1 if ($num != 0 && $num != $excluded);
19 exit 0;' leaks-log || \
20 { echo "Memory leak in $name" ; echo ""; cat leaks-log
; ec
=1; }
22 # [ "$ec" != "0" ] && { env PS1=": leaks-debugger !!!! ; " bash ; }
28 kill -9 $pid 2> /dev
/null