J
jimlee2004
I have a test script below.
It seems that there is memory leaks but all this script does is simply
open and close file handle,
Could somebody explain to me what is happening?
use strict;
use FileHandle;
open MY_HANDLE,">>","/tmp/test/testlog.1" or die $!;
my $a=0;
my $b=0;
while(1){
my $mystr="Something";
print MY_HANDLE $mystr;
$a++;
if ($a>1000)
{
$a=0;
close MY_HANDLE or die $!;
system("rm /tmp/test/testlog.$b");
$b++;
open MY_HANDLE,">>","/tmp/test/whatever.$b" or die $!;
}
}
It seems that there is memory leaks but all this script does is simply
open and close file handle,
Could somebody explain to me what is happening?
use strict;
use FileHandle;
open MY_HANDLE,">>","/tmp/test/testlog.1" or die $!;
my $a=0;
my $b=0;
while(1){
my $mystr="Something";
print MY_HANDLE $mystr;
$a++;
if ($a>1000)
{
$a=0;
close MY_HANDLE or die $!;
system("rm /tmp/test/testlog.$b");
$b++;
open MY_HANDLE,">>","/tmp/test/whatever.$b" or die $!;
}
}