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: "Le Ru" <address@hidden> >Subject: netCDF C++ - Memory usage >Organization: Capgemini >Keywords: 200501041620.j04GKmmE018531 Hi Pascal, > Institution: Capgemini > Package Version: 3.5 > Operating System: Linux > Hardware Information: . > Inquiry: I copy data between two NetCDF files using a single buffer (about 5 > Mo). > > This part of code is called several times. > When I watch the amount of memory used during this process, using > the free command, I can see that an unexpected amount of memory is > still used afer the copy is completed. > > Rational Purify tool doesn\'t detect any memory leak at the end of > the process. > > Is this a known problem ? The documentation for version 3.5.0 didn't make clear that the caller is responsible for deleting the memory space returned by Variable::values() method when no longer needed. There was also a memory leak in version 3.5.0, fixed in 3.5.1 and later releases, to make sure NcVar::cur_rec[] gets deleted in the NcVar destructor. I don't know of any memory leak problems in the current version 3.6.0. If you have a small test program that demonstrates a memory problem in the current version, we would appreciate getting it. --Russ _____________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu/staff/russ