[Jifty-commit] r4136 - in jifty/trunk: lib/Jifty/Plugin lib/Jifty/Plugin/LeakDetector

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Tue Sep 18 16:46:02 EDT 2007


Author: sartak
Date: Tue Sep 18 16:46:01 2007
New Revision: 4136

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Plugin/LeakDetector.pm
   jifty/trunk/lib/Jifty/Plugin/LeakDetector/View.pm

Log:
 r42800 at onn:  sartak | 2007-09-18 16:45:51 -0400
 Include the list of object types leaked in the request report


Modified: jifty/trunk/lib/Jifty/Plugin/LeakDetector.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/LeakDetector.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/LeakDetector.pm	Tue Sep 18 16:46:01 2007
@@ -48,10 +48,10 @@
     $self->generator->disable();
 
     my $leaked = $self->tracker->live_objects;
-    my $leaks = keys %$leaked;
+    my @leaks = keys %$leaked;
 
     # XXX: Devel::Size seems to segfault Jifty at END time
-    my $size = total_size([ keys %$leaked ]) - $empty_array;
+    my $size = total_size([ @leaks ]) - $empty_array;
 
     push @requests, {
         id => 1 + @requests,
@@ -59,7 +59,7 @@
         size => $size,
         objects => Dumper($leaked),
         time => scalar gmtime,
-        leaks => $leaks,
+        leaks => \@leaks,
     };
 
     $self->generator(undef);

Modified: jifty/trunk/lib/Jifty/Plugin/LeakDetector/View.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/LeakDetector/View.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/LeakDetector/View.pm	Tue Sep 18 16:46:01 2007
@@ -3,6 +3,7 @@
 
 package Jifty::Plugin::LeakDetector::View;
 use Jifty::View::Declare -base;
+use Scalar::Util 'blessed';
 
 =head1 NAME
 
@@ -47,13 +48,13 @@
 
                 for (@Jifty::Plugin::LeakDetector::requests)
                 {
-                    next if $_->{leaks} == 0 && $skip_zero;
+                    next if $skip_zero && @{$_->{leaks}} == 0;
 
                     row {
                         cell { a { attr { href => "leaks/$_->{id}" }
                                    $_->{id} } }
 
-                        cell { $_->{leaks} }
+                        cell { scalar @{$_->{leaks}} }
                         cell { $_->{size} }
                         cell { $_->{time} }
                         cell { $_->{url} }
@@ -73,11 +74,20 @@
             ul {
                 li { "URL: $leak->{url}" }
                 li { "Time: $leak->{time}" }
-                li { "Objects leaked: $leak->{leaks}" }
+                li { "Objects leaked: " . scalar(@{$leak->{leaks}}) }
                 li { "Total memory leaked: $leak->{size} bytes" }
             }
             p { a { attr { href => "/leaks" } "Table of Contents" } }
             hr {}
+            h2 { "Object types leaked:" }
+            ul {
+                my %seen;
+                for (map { blessed $_ } @{ $leak->{leaks} }) {
+                    next if $seen{$_}++;
+                    li { $_ }
+                }
+            }
+            hr {}
             pre { $leak->{objects} }
         }
     }


More information about the Jifty-commit mailing list