RE: [ncl-talk] Memory leak with if statement and logical array

From: O'Neill, Susan - Portland, OR <susan.oneill_at_nyahnyahspammersnyahnyah>
Date: Mon, 23 Apr 2007 17:34:06 -0600

Hi Dave & everyone,

I too have been struggling with a memory leak and was very excited to
see your message. Unfortunately, it did not fix things for me.
Attached is a very simple NCL script that loops through 3 yrs of flx
files (tst_memLeak.ncl). I removed all program logic except for loop
controls, system calls to un-tar & clean-up files, and opening the flx
files. As the program runs it steadily consumes more and more memory,
even after adding the explicit "True" to my logical if statements. It
starts out using approx 2% of memory and by the time it's run 24 months
it's using 27% of memory.

When I have actual code in the script (see attached
extractFlx_Montana.ncl), by the time 2 yrs have run 85% of memory is
being used and it takes hours to process through one flx file.

I can work around this by creating a wrapper script that only runs NCL a
month at a time using ENV variables to set loop controls, but would
really like to find a solution to this because I may want more data in
memory to do graphing or other data manipulations in the future.

Any insights/help/comments would be very appreciated! I am new to NCL
so could quite possibly be missing something too, thank you!

        Susan

--------------------------------------------
Susan M. O'Neill, Ph.D.
Air Quality Engineer
USDA Natural Resources Conservation Service
Air Quality and Atmospheric Change Team
1201 NE Lloyd Blvd., Suite 1000
Portland, Oregon 97232-1202
503-273-2438 (work)
503-273-2401 (fax)
susan.oneill_at_por.usda.gov
--------------------------------------------
-----Original Message-----
From: ncl-talk-bounces_at_ucar.edu [mailto:ncl-talk-bounces_at_ucar.edu] On
Behalf Of Dave Allured
Sent: Thursday, April 19, 2007 5:43 PM
To: ncl-talk_at_ucar.edu
Subject: Memory leak with if statement and logical array

Hello. I would like to report a possible memory leak problem in NCL
version 4.2.0.a034. This occurs when using an array of type logical
within an if statement. A significant amount of memory is lost each
time this statement is executed:

    if (flags(x)) then

If the direct array reference is changed to a logical expression,
the problem goes away:

    if (flags(x) .eq. True) then

The second form is a good workaround, but it might save significant
debugging time if the first form could be fixed.

Please see the attached script for a working demo. The double
nested loop is necessary in the complex application that I was
developing. Otherwise I would have never noticed the leak.

I am running NCL version 4.2.0.a034 on Mac OS:

mac56:~/narr 173> uname -a
Darwin mac56.cdc.noaa.gov 8.9.0 Darwin Kernel Version 8.9.0: Thu Feb
22 20:54:07 PST 2007; root:xnu-792.17.14~1/RELEASE_PPC Power
Macintosh powerpc

Thanks in advance to the NCL team for any bug fix that might be
provided.

--Dave A.
CU/CIRES Climate Diagnostics Center (CDC)
NOAA/ESRL/PSD, Climate Analysis Branch (CAB)

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Mon Apr 23 2007 - 17:34:06 MDT

This archive was generated by hypermail 2.2.0 : Thu Apr 26 2007 - 08:55:37 MDT