From d62ec5b38c1da1772447bdfd5c9053b2dc992c78 Mon Sep 17 00:00:00 2001 From: Benjamin Smedberg Date: Thu, 7 Jan 2010 15:14:27 -0500 Subject: [PATCH] Bug 538388 - Make find-leakers.pl work with the output of XPCOM_MEM_ALLOC_LOG as it dose with XPCOM_MEM_REFCNT_LOG, r=dbaron --- tools/rb/find-leakers.pl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/rb/find-leakers.pl b/tools/rb/find-leakers.pl index 16a6bf28e14d..36b8fd72a9ac 100755 --- a/tools/rb/find-leakers.pl +++ b/tools/rb/find-leakers.pl @@ -52,6 +52,8 @@ LINE: while (<>) { my $op = shift(@fields); my $cnt = shift(@fields); + # for AddRef/Release $cnt is the refcount, for Ctor/Dtor it's the size + if ($op eq 'AddRef' && $cnt == 1) { # Example: 0x01AFD3B8 1 AddRef 1 @@ -64,6 +66,18 @@ LINE: while (<>) { delete($allocs{$obj}); delete($classes{$obj}); } + elsif ($op eq 'Ctor') { + # Example: 0x08880BD0 8 Ctor (20) + + $allocs{$obj} = ++$counter{$class}; + $classes{$obj} = $class; + } + elsif ($op eq 'Dtor') { + # Example: 0x08880BD0 8 Dtor (20) + + delete($allocs{$obj}); + delete($classes{$obj}); + } }