Re: Memory issues in ncl

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri, 12 Oct 2007 10:31:17 -0600 (MDT)

Hi all,

When you do:

   var1 = (/var2/)

only the data values are copied from var2 to var1, and not the
metadata. This *might* explain why suddenly your script runs when
you do this, but it would be good to know for certain so we
know there's not some underlying bug.

There are a few ways you can run into memory issues in NCL. One
is if you create a lot of variables and never free them up
with the "delete" command. If you have some big arrays that you don't
need to use any more, get in the habit of removing them with
the "delete" command.

Another is if you create lots of strings. NCL stores strings for the
duration of the script even if you delete them, so this is memory
that you can never get back.

There have been some other memory problems that may be improved
in the next release of NCL, hopefully later this month.

Rich, would it be possible for you to provide us with your script
and data so we can make sure the memory problems are not a bug
somewhere? If so, email me separately and I'll provide a place
for you to ftp the files.

Thanks,

--Mary

On Fri, 12 Oct 2007 jyin_at_ucar.edu wrote:

> Hi Rich,
>
> I don't know if this is the problem you are running into, but I have had
> situations where the memory used by ncl (as reported by the Unix command
> "top") grew over time. I have found (by trial and error) that this can
> happen when one variable that has dimensions and/or attributes attached to
> it is assigned to another variable that has dimensions and/or attributes
> attached to it. For example:
>
> var1 = var2
>
> where both var1 and var2 have dimensions and/or attributes. If, instead,
> I just assign the value of var2 to var1:
>
> var1 = (/var2/)
>
> this problem of growing memory goes away. I don't know why this works,
> but perhaps someone on the NCL team can explain it...
>
> I hope that helps!
>
> Jeff
>
>> Has anyone ever had any issues with memory using ncl?
>>
>> I am running some code that basically reads variables from
>> a netcdf file and produces a plot. I have about 100 plots but
>> as it progresses it gets really slow. I have many procedures
>> and functions being used and am speculating it may be
>> some kind of memory leakage issue.
>>
>> Does anyone know of potential problems and/or whether there is a way
>> to track memory usage as the program runs.
>>
>> Thanks
>> Rich
>>
>>
>>
>> --
>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>> Richard Neale - Rm 304 - rneale_at_ucar.edu
>> http://www.cgd.ucar.edu/cms/rneale
>> Climate Modelling Section, CGD, NCAR
>> P.O. Box 3000, Boulder, CO 80307-3000
>> Tel (303) 497-1380 Fax (303) 497-1324
>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk_at_ucar.edu
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Oct 12 2007 - 10:31:17 MDT

This archive was generated by hypermail 2.2.0 : Fri Oct 12 2007 - 14:00:01 MDT