[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #VQG-715433]: NetCDF C Library V. 4.3.3.



Hello,

Thank you very much for the bug report, and for bringing 'H5free_memory' to my 
attention; I knew the hdf5 group had planned to include such a function, but I 
did not know it had been implemented.  I will make the appropriate changes to 
our configure/build system to detect the presence of H5free_memory and, when 
available use it.  This should be available in our next release.

Thanks again,

-Ward

> Hi,
> 
> 
> 
> I'm just developing a netCDF import filter for our data analysis software
> FlexPro.
> 
> I use the netCDF C library V.4.3.3 in Visual Studio 2013 and found a memory
> leak in the library.
> 
> 
> 
> Test Case: Open and close a nc file which contains compound variables.
> 
> 
> 
> Test program:
> 
> .
> 
> int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
> 
> flag |= _CRTDBG_LEAK_CHECK_DF; // Turn on leak-checking bit
> 
> _CrtSetDbgFlag(flag);
> 
> //_CrtSetBreakAlloc(2677); -> detected memory leak
> 
> 
> 
> strcpy(testfile, "d:\\temp\\compounds2.nc");
> 
> int ncid = 0;
> 
> 
> 
> if(nc_open(testfile, NC_NOWRITE, &ncid))
> 
> return -1;
> 
> 
> 
> if(nc_close(ncid))
> 
> return -1;
> 
> 
> 
> return 0;
> 
> .
> 
> 
> 
> Memory leak found in:
> 
> File: nc4file.c
> 
> Function: static int read_type(NC_GRP_INFO_T *grp, hid_t hdf_typeid, char
> *type_name)
> 
> .
> 
> member_name = H5Tget_member_name(type->native_hdf_typeid, m);
> 
> .
> 
> 
> 
> #ifndef JNA
> 
> /* Free the member name (which HDF5 allocated for us). */
> 
> /* On Windows using the
> microsoft runtime, it is an error
> 
> for one
> library to free memory allocated by a different library. */
> 
> #ifndef _MSC_VER
> 
> if(member_name != NULL) free(member_name);
> 
> #endif
> 
> #endif
> 
> 
> 
> In the current HDF5 library it exists the H5free_memory function which can
> be used:
> 
> 
> 
> #ifndef JNA
> 
> if(member_name != NULL)
> 
> H5free_memory((void*)member_name);
> 
> #endif
> 
> 
> 
> 
> 
> Best regards
> 
> _____
> 
> 
> Stefan Sattler
> 
> <http://www.weisang.com/> http://www.weisang.com
> 
> 
> Software Developer
> 
> 
> Weisang GmbH
> 
> 
> Voice +49 (6894) 92960-13
> 
> Sophie-Kraemer-Str. 13
> 
> 
> Fax   +49 (6894) 92960-26
> 
> D-66386 St. Ingbert
> 
> 
> Email  <mailto:address@hidden> address@hidden
> 
> Germany
> 
> 
> 
> _____
> 
> 
> 
> 
> 


Ticket Details
===================
Ticket ID: VQG-715433
Department: Support netCDF
Priority: Normal
Status: Closed