Changeset 2340
- Timestamp:
- 05/15/08 19:31:42 (6 months ago)
- Files:
-
- branches/release-38/lib/MT/TheSchwartz.pm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/release-38/lib/MT/TheSchwartz.pm
r2337 r2340 175 175 $did_work = 0; 176 176 if ($OBJECT_REPORT) { 177 leak_report(\%obj_start, \%obj_pre, \%Devel::Leak::Object::OBJECT_COUNT); 177 my $report = leak_report(\%obj_start, \%obj_pre, \%Devel::Leak::Object::OBJECT_COUNT); 178 $client->debug($report) if $report ne ''; 178 179 } 179 180 } … … 185 186 our %persistent; 186 187 BEGIN { 187 %persistent = map { $_ => 1 } qw( MT:: Task MT::Plugin MT::Component MT::ArchiveType MT::TaskMgr MT::WeblogPublisher MT::Serializer TheSchwartz::Job TheSchwartz::JobHandle );188 %persistent = map { $_ => 1 } qw( MT::Callback MT::Task MT::Plugin MT::Component MT::ArchiveType MT::TaskMgr MT::WeblogPublisher MT::Serializer TheSchwartz::Job TheSchwartz::JobHandle ); 188 189 } 189 190 sub leak_report { 190 191 my ($start, $pre, $post) = @_; 191 192 my $reported; 193 my $report = ''; 192 194 foreach my $class (sort keys %$post) { 193 195 # skip reporting classes that are persistent in nature … … 200 202 next if $post_count == 1; # ignores most singletons 201 203 if (($pre_count != $post_count) || ($post_count != $start_count)) { 202 print"Leak report (class, total, delta from last job(s), delta since process start):\n" unless $reported;203 printf "%-40s %-10d %-10d %-10d\n", $class, $post_count, $post_count - $pre_count, $post_count - $start_count;204 $report .= "Leak report (class, total, delta from last job(s), delta since process start):\n" unless $reported; 205 $report .= sprintf("%-40s %-10d %-10d %-10d\n", $class, $post_count, $post_count - $pre_count, $post_count - $start_count); 204 206 $reported = 1; 205 207 } 206 208 } 209 return $report; 207 210 } 208 211
