Subject: | DiskUsage - Cannot allocate memory |
I have a script that makes use of Sys::Statistics::Linux::DiskUsage.
This script is installed on multiple SUSE virtual machines (SUSE 10.1).
It has been compiled as a PAR executable on a SUSE machine (SUSE 10.3)
using Sys::Statistics::Linux version 0.47 and Perl version 5.8.8.
After running the script for roughly 20 days, every 5 to 10 seconds
(roughly 200,000 times) I am now getting the following error which I
only managed to fix by rebooting:
Sys::Statistics::Linux:DiskUsage: unable to execute 'df -kP' (Cannot
allocate memory) at Sys/Statistics/Linux.pm line 477
If I run df -kP manually there isn't a problem.
I have attached the part of my code which uses DiskUsage.
Subject: | diskInfo.pm |
my $lxs = Sys::Statistics::Linux -> new ( diskusage => 1 );
my $disk_stat = $lxs -> get -> {'diskusage'};
while ( my ( $key , $value ) = each ( %$disk_stat ) ) {
my $mnt = $disk_stat -> {$key} -> {'mountpoint'};
if ( exists $disk_loc{$mnt} ) {
my $id = $disk_loc{$mnt};
my $total_size = ( $disk_stat -> {$key} -> {'total'} * 1024 );
my $free_size = ( $disk_stat -> {$key} -> {'free'} * 1024 );
$p_return{"loc_$id"} = $mnt;
$p_return{"total_$id"} = $total_size;
$p_return{"free_$id"} = $free_size;
}
}