Jason and Saulius, I created an issue in JIRA. Sorry, it will not be implemented in 1.8.12, but we will try to address it in the next release.
Elena ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Elena Pourmal The HDF Group http://hdfgroup.org 1800 So. Oak St., Suite 203, Champaign IL 61820 217.531.6112 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ On Oct 23, 2013, at 4:39 PM, Saulius Raudeliunas <[email protected]> wrote: > You are quite right, Jason > > I also have this problem with the calls from another language - for example, > Delphi. > Thus I always have to add the following code in every new release myself: > > Add free memory for functions, returning * char > in: > H5public.h > > > H5_DLL herr_t H5free_mem(char * memToFree); > > > in: > H5.c > > herr_t > H5free_mem(char * memToFree) > { > herr_t ret_value = SUCCEED; > > FUNC_ENTER_API(FAIL) > H5TRACE0("e",""); > > /* Free memory */ > free(memToFree); > > done: > FUNC_LEAVE_API(ret_value) > } > > It would be nice to have such permanent improvement in version 1.8.12 and > higher. > > Regards, > Saulius > > -----Original Message----- > From: Hdf-forum [mailto:[email protected]] On Behalf Of > Jason Sommerville > Sent: Thursday, October 24, 2013 12:15 AM > To: [email protected] > Subject: [Hdf-forum] Freeing returned strings > > Is there a correct way to free strings returned by functions such as > H5Tget_member_name which return a char*? > > The documentation says that they should be freed after use. That's all well > and good until you're using two different memory allocators. For example, > I'm currently developing a DLL which calls into the hdf5 libraries. Since > I'm developing the dll, I'm in "_DEBUG" mode and using Microsoft's debug > memory management. Therefore, if I call free on the returned pointer, it's > likely to cause an access violation because the free routine does not match > the alloc routine (I'm using the standard library hdf5 library straight from > the web). > > I found a message to the forum from back in 2009 which is almost certainly > the same issue. Unfortunately, no one responded to the poor fellow. > > http://hdf-forum.184993.n3.nabble.com/free-buffer-returned-by-H5Tget-member- > name-result-in-runtime-error-in-Windows-Vista-tt194656.html > > Ideally, there would be a free function exported from the HDF5 library which > could be called to properly handle the deallocation. If there is, I haven't > found it in the docs. It seems like the proper function (MMfree, or > something like that) is #defined to free. Since it's a #define, it doesn't > end up helping at all. > > Thanks, > Jason > > _______________________________________________ > Hdf-forum is for HDF software users discussion. > [email protected] > http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org > > > _______________________________________________ > Hdf-forum is for HDF software users discussion. > [email protected] > http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
_______________________________________________ Hdf-forum is for HDF software users discussion. [email protected] http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
