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 Yuji, > Hello! A few months ago I sent you a mail asking whether there > is Windows-based netCDF library. At that time I had a negative > answer. > The problem is memory allocation. It seems that the netCDF > library allocates memory, but does not release anywhere. This > may cause memory leak. No that's not actually the problem. Every netCDF malloc() call has a corresponding free() that's called by the time an open netCDF file is closed. The circumstances we know of that cause memory leaks occur under (for us) unusual error conditions when not much memory is available, for example when malloc() fails repeatedly. The netCDF library doesn't recover well after a malloc() call has failed, and may not free all the memory previously allocated before the malloc() failure. > I have asked many people what I must do. A person said I can > release the allocated memory in the library itself and also in > my application. > Though I read the document of the library, I don't know what to > do. > I would very much appreciate your help. Although we don't port code to Windows platforms, we know of a company in Europe that successfully ported the netCDF library to Windows NT, in the form of an easy-to-use DLL library. They said the work was in making the library reentrant. Currently it is not reentrant, since, for example, global variables are used to return information about errors and to control error handling. Although we have asked for a copy of the modified sources for their DLL library version, we haven't received the necessary modifications yet. We don't have any Windows programmers here and so must rely on the community for this port, so I'm sorry to say we can't be of much more help. ______________________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden P.O. Box 3000 http://www.unidata.ucar.edu/ Boulder, CO 80307-3000 ______________________________________________________________________________