- changed status to open
- removed comment
change HDF5's file open options to close all sub-file objects when a file is closed
this is strictly speaking not necessary, since any need for it is caused by a HDF5 object leak. On the other hand it does not hurt either additionally one could overload H5Fclose and warn the user when there are still open objects when a file is closed, ie:
//////////////// Close HDF5 file checking for leaked objects //////////////// static herr_t H5Fclose (hid_t file) { DECLARE_CCTK_PARAMETERS;
herr_t retval; int error_count = 0;
hsize_t objectcount; HDF5_ERROR (objectcount = H5Fget_obj_count(file, H5F_OBJ_ALL | H5F_OBJ_LOCAL)); if (objectcount > 1) { std::vector<char> fn; hsize_t sz_fn;
HDF5_ERROR (sz_fn = H5Fget_name(file, NULL, 0)); fn.resize(sz_fn+1); HDF5_ERROR (H5Fget_name(file, &fn[0], fn.size()));
CCTK_VWarn (1, LINE, FILE, CCTK_THORNSTRING, "%d open HDF5 objects when closing file '%s'", int(objectcount)-1, &fn[0]); } HDF5_ERROR (retval = ::H5Fclose (file));
return retval; }
Keyword: CarpetIOHDF5
Comments (3)
-
reporter -
- changed status to open
- removed comment
I assume this will help reduce memory usage for HDF5. Please apply.
-
reporter - changed status to resolved
- removed comment
I applied the patch (but not the overloaded HDF5 close function) as Carpet hash f0dc71726af0 "CarpetIOHDF5: close all HDF5 objects when closing a file".
- Log in to comment