This is a C library issue, not C++, so we don't have new operators or std::vectors.
While that's an interesting idea, I'd argue that providing a simple free function to users is a much easier and more direct solution.
Dana
···
From: Hdf-forum [mailto:hdf-forum-bounces@lists.hdfgroup.org] On Behalf Of Werner Benger
Sent: Monday, March 24, 2014 5:02 PM
To: HDF Users Discussion List
Subject: Re: [Hdf-forum] RFC: Freeing Memory Allocated by the HDF Library
Looks all good to me.
As a possible alternative to the two-function call version to allocate memory, options might also be to define something like a "memory manager" which contains a structure of function calls that do allocation/freeing, or just passing such a memory allocation function to those HDF5 functions that need to allocate memory. That way you could have a single HDF5 function call using a user-defined function to allocate memory, for instance a function allocating via the C++ new operator or putting data into a C++ std::vector<> object. This however comes with some danger of C++ exceptions being thrown in such an allocation function, so it at least needs to be documented how to deal with such situations.
Werner
On 24.03.2014 19:34, Dana Robinson wrote:
Hi all,
This is a brief RFC that outlines a new HDF5 API function, H5free_memory(), which can be used to free memory returned from the HDF5 library (e.g., via functions like H5Tget_member_name()). This will be of particular interest to Windows users, since this will help mitigate the problems of linking to multiple versions of the C runtime.
The new function will appear in HDF5 1.8.13, which will be released in May.
If anyone has any comments or concerns, please let us know.
Cheers,
Dana
_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org<mailto:Hdf-forum@lists.hdfgroup.org>
http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
--
___________________________________________________________________________
Dr. Werner Benger Visualization Research
Center for Computation & Technology at Louisiana State University (CCT/LSU)
2019 Digital Media Center, Baton Rouge, Louisiana 70803
Tel.: +1 225 578 4809 Fax.: +1 225 578-5362