[Re] RFC: Freeing Memory Allocated by the HDF Library

Hello Dana!

Your proposal looks good. I have a couple minor comments:

1) The document mentions a problem with C Runtime version conflict. However another severe problem exists with data allocated by library but freed by user code: foreign language bindings. If using the library from language with its' own memory manager (like Delphi/FreePascal) it's next to impossible to properly free memory allocated inside the library. The document should probably mention this also.

2) Why H5free_memory and not just H5free? :wink:

Best wishes,
Andrey Paramonov

···

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Why H5free_memory and not just H5free? :wink:

If I saw "H5free" in an API, I'd start looking for "H5malloc".

Similarly, if I saw "H5free_memory" I'd think someone didn't know C
custom is to use "free".

H5free_buffers gives some indication that they're long-lived storage
locations and likely not to be mucked with casually.

- Rhys

The point is to visually distinguish the function from free(). After all, if the user uses H5free_memory() to free a buffer they allocated, then they have the original problem, only reversed :slight_smile:

The longer function name indicates that it is special and has a particular use.

Dana

···

-----Original Message-----
From: Hdf-forum [mailto:hdf-forum-bounces@lists.hdfgroup.org] On Behalf
Of Rhys Ulerich
Sent: Tuesday, March 25, 2014 9:10 AM
To: HDF Users Discussion List
Subject: Re: [Hdf-forum] [Re] RFC: Freeing Memory Allocated by the HDF
Library

> Why H5free_memory and not just H5free? :wink:

If I saw "H5free" in an API, I'd start looking for "H5malloc".

Similarly, if I saw "H5free_memory" I'd think someone didn't know C custom is
to use "free".

H5free_buffers gives some indication that they're long-lived storage locations
and likely not to be mucked with casually.

- Rhys

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org

Hi,

1) The document mentions a problem with C Runtime version conflict.
However another severe problem exists with data allocated by library but
freed by user code: foreign language bindings. If using the library from
language with its' own memory manager (like Delphi/FreePascal) it's next to
impossible to properly free memory allocated inside the library. The
document should probably mention this also.

[Dana Robinson]
I do mention this in section 4.3.

Dana