To avoid heap corruption, allocated memory should be freed using the same library that initially allocated it. In most cases, the HDF5 API uses resources that are allocated and freed either entirely by the user or entirely by the library, so this is not a problem. In rare cases, however, HDF5 API calls will free memory that the user allocated. This function allows the user to safely allocate this memory.
It is particularly important to use this function to allocate memory in Microsoft Windows environments. In 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 multiple versions of the CRT DLLs (debug, release, et cetera) and allocating and freeing memory across DLL boundaries can cause resource leaks and subtle bugs due to heap corruption.
Even when using this function, it is best where possible to ensure that all components of a C application are built with the same version of Visual Studio and configuration (Debug or Release), and thus linked against the same CRT.
Use this function only to allocate memory inside third-party HDF5 filters. It will generally not be safe to use this function to allocate memory for any other purpose.