Changeset 5e6e9e6369150833509caab051a5ba44d30b89b5

Show
Ignore:
Timestamp:
05/03/10 15:17:10 (5 years ago)
Author:
Jason Dixon <jdixon@omniti.com>
git-committer:
Jason Dixon <jdixon@omniti.com> 1272899830 +0000
git-parent:

[c8051cbc1da99542d24ed957f0fac1e7abb71c9f]

git-author:
Jason Dixon <jdixon@omniti.com> 1272899830 +0000
Message:

only create our kstat object once, update() each time. fixes memory leakage.

git-svn-id: https://labs.omniti.com/resmon/branches/resmon2@347 8c0face9-b7db-6ec6-c4b3-d5f7145c7d55

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lib/Core/Memstat.pm

    rb8708d6 r5e6e9e6  
    77 
    88use Resmon::ExtComm qw(run_command cache_command); 
     9 
     10my $osname = $^O; 
     11my $usekstat = 0; 
     12my $kstat; 
     13if ($osname eq 'solaris') { 
     14    eval "use Sun::Solaris::Kstat"; 
     15    unless ($@) { 
     16        $usekstat = 1; 
     17        $kstat = Sun::Solaris::Kstat->new(); 
     18    } 
     19} 
    920 
    1021=pod 
     
    90101    my $config = $self->{'config'}; 
    91102    my $vmstat_path = $config->{'vmstat_path'} || 'vmstat'; 
    92     my $osname = $^O; 
    93103 
    94104    if ($osname eq 'solaris') { 
    95         my $usekstat = 0; 
    96105        my $pagesize = run_command('pagesize'); 
    97         my $kstat; 
    98         eval "use Sun::Solaris::Kstat"; 
    99         unless ($@) { 
    100             $usekstat = 1; 
    101             $kstat = Sun::Solaris::Kstat->new(); 
    102         } 
    103106        if ($usekstat && $pagesize) { 
    104107            my %metrics; 
     108            $kstat->update(); 
    105109            my $syspages = $kstat->{'unix'}->{0}->{'system_pages'}; 
    106110