This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Hi, Thanks for the report; it should of course be possible to get rid of the memory leak, assuming we can identify it properly. Can you tell me what version of the fortran and underlying C libraries you are using? -Ward > > Dear Unidata support, > > We encountered a memory leak in a NetCDF interface for Fortran 90. The > memory leak occurs when a there is an attribute that is a compound that > contains a string. The memory is leaked when just opening and closing > the file with nf90_open and nf90_close. Below, I will give an NCDUMP > output of a small leaking NetCDF file. > > We already contacted the HDF5 support and the memory leak does not occur > when reading the same file with just the HDF5 interface. > > For development, however, we prefer the nf90-interface above the > h5-interface. Is there a possibility to get rid of the memory leak with > the nf90-interface? > > NCDUMP output of a leaking NetCDF file: > netcdf memory_leak { > types: > compound cmp { > string content1 ; > string content2 ; > }; // cmp > variables: > float var ; > cmp var:att = {"example", "X"} ; > data: > > var = 5.2 ; > } > > When opening and closing the file, 10 bytes of memory are leaked, equal > to the sum of the string lengths (including termination characters). > > Thanks in advance, > Joost > > Ticket Details =================== Ticket ID: YFC-341618 Department: Support netCDF Priority: Normal Status: Closed