I'm experiencing a memory leak (I think) in this snippet of code:
if (ref($init{'time-layout'}) eq 'HASH') {
my %time= % {$init{'time-layout'}};
my @times= @ {$time{'start-valid-time'}};
if (ref($init{parameters}) eq 'HASH') {
%param= % {$init{parameters}};
if (ref($param{'wind-speed'}) eq 'HASH') {
%wind= % {$param{'wind-speed'}};
@windvalue= @ {$wind{value}};
%temp= % {$param{'temperature'}};
@tempvalue = @ {$temp{value}};
%wdir= % {$param{'direction'}};
@wdirvalue = @ {$wdir{value}};
%hum= % {$param{'humidity'}};
@humvalue = @ {$hum{value}};
undef %wind;
undef %temp;
undef %wdir;
undef %hum;}
undef %param;}
This is from a sub, where the input comes from XMLin() (from XML::Simple). Specifically the input is (if it matters)
http://graphical.weather.gov/xml/sample_products/browser_interface/ndfdXMLclient.php? lat=$lat&lon=$lon&product=time-series&begin=2004-01-01T00:00:00&end=2013-04-20T00:00:00&temp=temp&wspd=wspd&rh=rh&wdir=wdir";
where $lat
and $lon
are latitude and longitude.
The code takes a couple hours, to run plugging data into a SQL server, and well before it's done the instance of Perl is taking several GBs of RAM or more. I'm sure this is simple for someone but I'm, at best, a novice in Perl.