Page tree


How can I resolve problems due to objects being left open?

If an object (group, dataset, etc.) in a file is not closed, then the file does not get closed, which can cause problems.

There are some things you can do. You can either close everything automatically, or get the number of open objects and then close them:

 

  1. We have a file access property list that you can use to do a 'strong' close of a file. See the function:  H5Pset_fclose_degree.
    See the example program h5close.c.

     

  2. You can call H5close, and that will automatically close everything.

     

  3. You can call H5Fget_obj_count to get the number of open object identifiers for an open file.
    You can call H5Fget_obj_ids to get the list of open object identifiers.
    See the example program: h5ckopen.c

(Note that these routines do not work with dataspace objects.)