[ET Trac] [Einstein Toolkit] #1032: change HDF5's file open options to close all sub-file objects when a file is closed
Einstein Toolkit
trac-noreply at einsteintoolkit.org
Thu Aug 9 00:40:37 CDT 2012
#1032: change HDF5's file open options to close all sub-file objects when a file
is closed
--------------------------+-------------------------------------------------
Reporter: rhaas | Owner: eschnett
Type: enhancement | Status: new
Priority: minor | Milestone:
Component: Carpet | Version:
Keywords: CarpetIOHDF5 |
--------------------------+-------------------------------------------------
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;
}
}}}
--
Ticket URL: <https://trac.einsteintoolkit.org/ticket/1032>
Einstein Toolkit <http://einsteintoolkit.org>
The Einstein Toolkit
More information about the Trac
mailing list