[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

20010829: Out of memory in recget (NetCDF Perl)



Su-Tzai Soong,

> To: address@hidden
> From: Su-Tzai Soong <address@hidden>
> Subject: Out of memory in recget
> Organization: University of California at Davis
> Keywords: 200108292236.f7TMaQ104813

The above message contained the following:

> I got an "Out of memory!" error after 296 loops in the following code to 
> read a CDC reanalysis data for height of 1998:
> 
> for ($n = 0; $n < $dimsize; $n++) {
>     @record = ();
>     $status = NetCDF::recget($ncid, $n, \@record);
>     ($status >= 0) || die "Couldn't read record\n";
>     print STDERR "   record $n\n";
> }
> 
> The only possibility I can think of is that recget repeatedly allocate 
> memory for the data pointed to by record.  Is there a way to free these 
> memories?
> 
> Steve

What happens if you move the statement that sets "@record" to an empty
array to before the "for" loop?

Regards,
Steve Emmerson   <http://www.unidata.ucar.edu>