Page tree

 

JAVA

FORTRAN

C++

C

 

Link

H5_FREE_MEMORY

Frees memory allocated by the HDF5 library

Procedure:

H5_FREE_MEMORY(buf)

Signature:

herr_t H5free_memory
(
    void *buf
)

Parameters:
void *mem   IN: Buffer to be freed. Can be NULL

Description:

H5_FREE_MEMORY frees memory that has been allocated by the caller with H5_ALLOCATE_MEMORY or by the HDF5 library on behalf of the caller.

H5T_GET_MEMBER_NAME provides an example of memory allocation on behalf of the caller: The function returns a buffer containing the name of a compound datatype member. It is the caller’s responsibility to eventually free that buffer with H5_FREE_MEMORY.

It is especially important to use this function to free memory allocated by the library on Windows. The C standard library is implemented in dynamic link libraries (DLLs) known as the C run-time (CRT). Each version of Visual Studio comes with two CRT DLLs (debug and release) and allocating and freeing across DLL boundaries can cause resource leaks and subtle bugs due to heap corruption.

Only use this function to free memory allocated by the HDF5 Library. It will generally not be safe to use this function to free memory allocated by any other means.

Even when using this function, it is still best to ensure that all components of a C application are built with the same version of Visual Studio and build (debug or release) and thus linked against the same CRT.

Returns:

Returns a non-negative value if successful. Otherwise returns a negative value.

Example:

Coming soon!

See Also:

  • Page:
    H5_ALLOCATE_MEMORY — Allocates memory that will later be freed internally by the HDF5 library

  • Page:
    H5_RESIZE_MEMORY — Resizes and, if required, re-allocates memory that will later be freed internally by the HDF5 library

History:
ReleaseChange
1.8.13C function introduced with this release.

--- Last Modified: July 25, 2019 | 02:13 PM