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

[netCDF #OBW-613992]: Possible memory leak in nf90_get_var (netcdf/4.3.0)



Hello Jan,

Thank you for the comprehensive report; it will make investigating this much 
faster.  Out of curiosity, what version of netcdf-fortran were you using?  The 
current releases of netcdf-c and netcdf-fortran are 4.3.3.1 and 4.4.2, 
respectively.  It appears that you are using an older netcdf-c library, I am 
curious if these issues still occur in the most recent version.

Thanks again for the test cases; I will have to investigate this more closely.

Have a great day!

-Ward

> Dear Unidata support,
> 
> I've run into a problem that is possibly a memory leak in the netCDF library 
> (netcdf/4.3.0). When I use nf90_get_var to read from a series of netCDF 
> archives, eventually all RAM on the machine ends up being used, even though 
> every netCDF archive is closed before the next one is opened (chunk cache is 
> not the cause).
> 
> I attached a demonstration code (memory_leak_demo.tgz). It can be compiled by 
> running the compile.sh script, after setting the FC (Fortran compiler) and 
> NETCDF (path to netCDF library) environment variables. The demonstration code 
> has two executables:
> 
> memory_leak_demo_1: Creates one netCDF archive with data, and reads the data 
> from the archive once.
> 
> memory_leak_demo_2 : Creates ten netCDF archives with data, and reads the 
> data from each of the ten archives once.
> 
> The executables use only one array (of the same size) to read the data, and 
> hence should use the same amount of memory - but they don't. I attached PBS 
> output logs for the two executables (compiled with intel/14.0.2):
> 
> MEMORY_LEAK_DEMO_1_THEIA.sh.o5600419
> MEMORY_LEAK_DEMO_2_THEIA.sh.o5600420
> 
> Comparing these, memory_leak_demo_2 uses about 5 times more memory than 
> memory_leak_demo_1. I suspect this indicates a memory leak (unless I am 
> missing something crucial).
> 
> Jan
> 
> 
> 


Ticket Details
===================
Ticket ID: OBW-613992
Department: Support netCDF
Priority: Normal
Status: Closed