Open objects use up memory. The amount of memory used may be substantial when many objects are left open. You should:
- Check for all open HDF5 object identifiers.
- Delay opening of files and datasets as close to their actual use as is feasible.
- Close files and datasets as soon as their use is completed.
- If writing to a portion of a dataset in a loop, be sure to close the dataspace with each iteration, as this can cause a large temporary "memory leak".
There are APIs to determine if datasets and groups are left open. H5F_GET_OBJ_COUNT will get the number of open objects in the file, and H5F_GET_OBJ_IDS will return a list of the open object identifiers.