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, > > We've compiled NetCDF 4.0.1 in Visual Studio 2008 on Windows XP. There > is a file in the NetCDF 4.0.1 distribution called > libsrc4\ref_tst_compounds.nc. When I try to call nc_open on that file > with the following code: > > int fileid; > nc_open("ref_tst_compounds.nc", NC_NOWRITE, &fileid); > > there is a crash inside nc_open, in Debug mode only. The error occurs > at nc4hdf.c:1954, at the line that says: > > /* HDF5 allocated this for us. */ > free(member_name); > > What seems to be happening is that the NetCDF library is freeing a > variable that was allocated by HDF5, and there may be an allocate/free > mismatch that has undefined behavior, and therefore has different > effects with different compilers / operating systems. > Did you have to change the solution file to build 4.0.1? If so, can you send me your solution files you developed for building 4.0.1? To answer your question, when reading vlens the HDF5 library does allocate the memory. I would firstly suggest you get the daily snapshot, as there have been memory leaks fixed since the 4.0.1 release. Get the latest snapshot here: ftp://ftp.unidata.ucar.edu/pub/netcdf/snapshot/netcdf-4-daily.tar.gz > > If possible, can this be fixed in a future version of the NetCDF library? > If we can find the fix, I can make sure it makes it into future releases. ;-) Thanks, Ed Ticket Details =================== Ticket ID: CTP-858274 Department: Support netCDF Priority: Urgent Status: Open