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.
>To: address@hidden >From: address@hidden (Gordon Maclean) >Subject: netcdf memory leak and 3.3.1 sync() >Organization: . >Keywords: 199709231637.KAA17081 Hi Gordon, > This is a rambling report of some memory leaks, and issues connected with > syncing files. > > > In > NcVar* NcFile::add_var(NcToken, NcType, int , const NcDim**) > > you need to delete[] dimids before returning. > > This leak exists in the C++ code for version 2.4.3 and 3.3.1. This leak > has probably been reported, though I didn't see anything about it in > the support email archive. Yes, thanks, you're right about the leak. I've fixed it as you suggest, and it will be in the next minor release (unless it's too late for that; Glenn?). > NcVar::edges() returns a pointer which is not managed (deleted) by > NcVar. The documentation says it returns a const pointer. This issue > needs to be sorted out, who owns the pointer? The documentation was wrong; the caller needs to delete the returned array of edge lengths when done with it. Thanks for pointing out the inconsistency. I've fixed the documentation. --Russ