Memory allocation failed for raw data chunk

One way to find out is by using valgrind.

From your description it is not possible to tell what is inside the loop, and how resource allocations are handled; however I can tell that the HDF5 CAPI checked out fine for all recent versions.
If C++ is an options for you, then recommend you H5CPP an easy to use persistence for modern C++. Its packet table implementation is profiled, and covers most use cases.

Chris Drozdowski got H5CPP up working on Windows – by making adjustment to the header files.

Here are his words:

Your project is simply awesome! Just a few lines of code allows me to generate the HDF5 files I need. You’ve done a great service to the community.

If you are interested in the windows setup either contact him, or I can post his method. As soon as schedule allows I will incorporate his method as well as a cross compiled binary of the LLVM based reflection tool for windows.

hope it helps: steve