Added temporary workaround for debug memory leak in Text::ASCIITable
Andy Grundman [Fri, 23 Sep 2005 19:29:17 +0000 (19:29 +0000)]
Changes
lib/Catalyst.pm
lib/Catalyst/Dispatcher.pm
lib/Catalyst/Engine.pm
lib/Catalyst/Setup.pm

diff --git a/Changes b/Changes
index 55b8d78..6292496 100644 (file)
--- a/Changes
+++ b/Changes
@@ -6,6 +6,8 @@ This file documents the revision history for Perl extension Catalyst.
         - Fixed bug in dispatcher where an invalid path could call a valid
           action. (Andy Grundman)
         - Fixed Helper so it works with CRLF line-endings. (Andy Grundman)
+        - Added workaround for debug mode memory leak in Text::ASCIITable.
+          (Andy Grundman)
 
 5.33  2005-08-10 15:25:00
         - Now with updated manifest.
index 9a1149b..bf3049b 100644 (file)
@@ -7,7 +7,6 @@ use Catalyst::Exception;
 use Catalyst::Log;
 use Catalyst::Utils;
 use NEXT;
-use Text::ASCIITable;
 use Path::Class;
 our $CATALYST_SCRIPT_GEN = 4;
 
index cb01934..99bbba7 100644 (file)
@@ -428,6 +428,7 @@ sub setup_actions {
 
     my $actions  = $self->actions;
     my $privates = Text::ASCIITable->new;
+    undef $privates->{tiedarr};    # work-around for a memory leak
     $privates->setCols( 'Private', 'Class' );
     $privates->setColWidth( 'Private', 36, 1 );
     $privates->setColWidth( 'Class',   37, 1 );
@@ -451,6 +452,7 @@ sub setup_actions {
       if ( @{ $privates->{tbl_rows} } );
 
     my $publics = Text::ASCIITable->new;
+    undef $publics->{tiedarr};    # work-around for a memory leak
     $publics->setCols( 'Public', 'Private' );
     $publics->setColWidth( 'Public',  36, 1 );
     $publics->setColWidth( 'Private', 37, 1 );
@@ -466,6 +468,7 @@ sub setup_actions {
       if ( @{ $publics->{tbl_rows} } );
 
     my $regexes = Text::ASCIITable->new;
+    undef $regexes->{tiedarr};    # work-around for a memory leak
     $regexes->setCols( 'Regex', 'Private' );
     $regexes->setColWidth( 'Regex',   36, 1 );
     $regexes->setColWidth( 'Private', 37, 1 );
index de7e082..36b839b 100644 (file)
@@ -419,6 +419,7 @@ sub handler {
             my $av = sprintf '%.3f',
               ( $elapsed == 0 ? '??' : ( 1 / $elapsed ) );
             my $t = Text::ASCIITable->new;
+            undef $t->{tiedarr};    # work-around for a memory leak
             $t->setCols( 'Action', 'Time' );
             $t->setColWidth( 'Action', 64, 1 );
             $t->setColWidth( 'Time',   9,  1 );
@@ -519,6 +520,7 @@ sub prepare {
 
     if ( $c->debug && keys %{ $c->req->params } ) {
         my $t = Text::ASCIITable->new;
+        undef $t->{tiedarr};    # work-around for a memory leak
         $t->setCols( 'Key', 'Value' );
         $t->setColWidth( 'Key',   37, 1 );
         $t->setColWidth( 'Value', 36, 1 );
index be83e17..00baaef 100644 (file)
@@ -95,6 +95,7 @@ sub setup {
 
         if ( @plugins ) {
             my $t = Text::ASCIITable->new;
+            undef $t->{tiedarr};    # work-around for a memory leak
             $t->setOptions( 'hide_HeadRow',  1 );
             $t->setOptions( 'hide_HeadLine', 1 );
             $t->setCols('Class');
@@ -127,6 +128,7 @@ sub setup {
 
     if ( $class->debug ) {
         my $t = Text::ASCIITable->new;
+        undef $t->{tiedarr};    # work-around for a memory leak
         $t->setOptions( 'hide_HeadRow',  1 );
         $t->setOptions( 'hide_HeadLine', 1 );
         $t->setCols('Class');