Ignore:
Timestamp:
10/29/09 11:09:03 (3 years ago)
Author:
SvenDowideit
Message:

Item2286: port memory leak changes from rel branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/tools/MemoryCycleTests.pl

    r1065 r5392  
    2121use Devel::Monitor qw(:all); 
    2222 
     23 
    2324BEGIN { 
    24     use File::Spec; 
    25  
    26     unshift @INC, split(/:/, $ENV{FOSWIKI_LIBS} || '../lib' ); 
    27  
    28     # designed to be run within a SVN checkout area 
    29     my @path = split( /\/+/, File::Spec->rel2abs($0) ); 
    30     pop(@path); # the script name 
    31  
    32     while (scalar(@path) > 0) { 
    33         last if -d join( '/', @path).'/twikiplugins/BuildContrib'; 
    34         pop( @path ); 
     25    if ( defined $ENV{GATEWAY_INTERFACE} ) { 
     26        $Foswiki::cfg{Engine} = 'Foswiki::Engine::CGI'; 
     27        use CGI::Carp qw(fatalsToBrowser); 
     28        $SIG{__DIE__} = \&CGI::Carp::confess; 
    3529    } 
    36  
    37     if(scalar(@path)) { 
    38         unshift @INC, join( '/', @path ).'/lib'; 
    39         unshift @INC, join( '/', @path ).'/twikiplugins/BuildContrib/lib'; 
     30    else { 
     31        $Foswiki::cfg{Engine} = 'Foswiki::Engine::CLI'; 
     32        require Carp; 
     33        $SIG{__DIE__} = \&Carp::confess; 
    4034    } 
     35    $ENV{FOSWIKI_ACTION} = 'view'; 
     36    @INC = ('../bin', grep { $_ ne '.' } @INC); 
     37    require 'setlib.cfg'; 
    4138} 
    4239 
     
    4542 
    4643{ 
    47     my $twiki = new Foswiki(); 
    48     $Foswiki::Plugins::SESSION = $twiki; 
    49     monitor('TWiki' => \$Foswiki::Plugins::SESSION ); 
     44    my $session = new Foswiki(); 
     45 
     46    #NOTE that Foswiki::finish() is hiding many circular references by foricbly clearing 
     47    #them with the %$this = (); its worth uncommenting this line once in a while to  
     48    #see if its gettign worse (56 are found as of Jun2006) 
     49    #*Foswiki::finish = sub {}; 
     50 
     51    $Foswiki::Plugins::SESSION = $session; 
     52    monitor('Foswiki' => \$Foswiki::Plugins::SESSION ); 
    5053 
    5154    Foswiki::UI::run( \&Foswiki::UI::View::view ); 
    52      
    53     #NOTE that Foswiki::finish() is hiding many circular references by foricbly clearing 
    54     #them with the %$this = (); its worth commenting out this line once in a while to  
    55     #see if its gettign worse (56 are found as of Jun2006) 
    5655     
    5756    print_circular_ref(\$Foswiki::Plugins::SESSION ); 
Note: See TracChangeset for help on using the changeset viewer.