[svn-r28027] Purpose: Fix memory leaks

Description:
    - Removed H5Library::instance because it is unnecessary.  All H5Library's
      methods are static.  This, in turn, removed the memory leaks by
      H5Library::instance not being deleted.
    - Added ObjCreatPropList::deleteConstants to atexist() list
    - Cleaned up comments and format inconsistencies with 1.8
Platforms tested:
    Linux/32 2.6 (jam)
    Linux/64 (platypus)
    Darwin (osx1010test)
This commit is contained in:
Binh-Minh Ribler
2015-10-10 23:05:21 -05:00
parent cd49e8a2ab
commit fc84edb7e3
15 changed files with 136 additions and 127 deletions

View File

@@ -133,28 +133,26 @@ void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPro
// create the file.
if( flags & (H5F_ACC_EXCL|H5F_ACC_TRUNC))
{
hid_t create_plist_id = create_plist.getId();
hid_t access_plist_id = access_plist.getId();
id = H5Fcreate( name, flags, create_plist_id, access_plist_id );
if( id < 0 ) // throw an exception when open/create fail
{
throw FileIException("H5File constructor", "H5Fcreate failed");
}
hid_t create_plist_id = create_plist.getId();
hid_t access_plist_id = access_plist.getId();
id = H5Fcreate( name, flags, create_plist_id, access_plist_id );
if( id < 0 ) // throw an exception when open/create fail
{
throw FileIException("H5File constructor", "H5Fcreate failed");
}
}
// Open the file if none of the bits above are set.
else
{
hid_t access_plist_id = access_plist.getId();
id = H5Fopen( name, flags, access_plist_id );
if( id < 0 ) // throw an exception when open/create fail
{
throw FileIException("H5File constructor", "H5Fopen failed");
}
hid_t access_plist_id = access_plist.getId();
id = H5Fopen( name, flags, access_plist_id );
if( id < 0 ) // throw an exception when open/create fail
{
throw FileIException("H5File constructor", "H5Fopen failed");
}
}
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
// Function: H5File overloaded constructor
///\brief Creates an H5File object using an existing file id.
@@ -174,6 +172,8 @@ H5File::H5File(hid_t existing_id) : H5Location(), CommonFG()
incRefCount(); // increment number of references to this id
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
// Function: H5File copy constructor
///\brief Copy constructor: makes a copy of the original
@@ -523,16 +523,16 @@ hsize_t H5File::getFileSize() const
}
//--------------------------------------------------------------------------
// Function: H5File::getId
// Function: H5File::getId
///\brief Get the id of this file
///\return File identifier
// Modification:
// May 2008 - BMR
// Class hierarchy is revised to address bugzilla 1068. Class
// AbstractDS and Attribute are moved out of H5Object. In
// addition, member IdComponent::id is moved into subclasses, and
// IdComponent::getId now becomes pure virtual function.
// Programmer Binh-Minh Ribler - May, 2008
// May 2008 - BMR
// Class hierarchy is revised to address bugzilla 1068. Class
// AbstractDS and Attribute are moved out of H5Object. In
// addition, member IdComponent::id is moved into subclasses, and
// IdComponent::getId now becomes pure virtual function.
// Programmer Binh-Minh Ribler - May, 2008
//--------------------------------------------------------------------------
hid_t H5File::getId() const
{
@@ -540,19 +540,6 @@ hid_t H5File::getId() const
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
// Function: H5File::getLocId
// Purpose: Get the id of this file
// Description
// This function is a redefinition of CommonFG::getLocId. It
// is used by CommonFG member functions to get the file id.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
hid_t H5File::getLocId() const
{
return( getId() );
}
//--------------------------------------------------------------------------
// Function: H5File::reopen
// Purpose: Reopens this file.
@@ -567,16 +554,29 @@ void H5File::reopen()
}
//--------------------------------------------------------------------------
// Function: H5File::p_setId (protected)
///\brief Sets the identifier of this object to a new value.
// Function: H5File::getLocId
// Purpose: Get the id of this file
// Description
// This function is a redefinition of CommonFG::getLocId. It
// is used by CommonFG member functions to get the file id.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
hid_t H5File::getLocId() const
{
return( getId() );
}
//--------------------------------------------------------------------------
// Function: H5File::p_setId (protected)
///\brief Sets the identifier of this object to a new value.
///
///\exception H5::IdComponentException when the attempt to close the HDF5
/// object fails
///\exception H5::IdComponentException when the attempt to close the HDF5
/// object fails
// Description:
// The underlaying reference counting in the C library ensures
// that the current valid id of this object is properly closed.
// Then the object's id is reset to the new id.
// Programmer Binh-Minh Ribler - 2000
// The underlaying reference counting in the C library ensures
// that the current valid id of this object is properly closed.
// Then the object's id is reset to the new id.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void H5File::p_setId(const hid_t new_id)
{