diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2012-04-02 03:14:19 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2012-04-02 03:14:19 (GMT) |
commit | 88ce565d7d324569f2a360aa37bfeefffa021a8a (patch) | |
tree | 94e9dc7c38bb49e7c70c42f6c3fcca73eacfd545 /c++/src/H5PredType.h | |
parent | 42306f8ed4ade51a8629b9c5a159d1afac5f617f (diff) | |
download | hdf5-88ce565d7d324569f2a360aa37bfeefffa021a8a.zip hdf5-88ce565d7d324569f2a360aa37bfeefffa021a8a.tar.gz hdf5-88ce565d7d324569f2a360aa37bfeefffa021a8a.tar.bz2 |
[svn-r22235] Purpose: Fixed bugs HDFFV-2761 & HDFFV-7852
Description:
- Replaced PredType::NotAtexit() with PredType::AtExit(H5CPP_EXITED);
and used PredType::AtExit as a flag to detect when all predefined
types have been destroyed. Then, H5close will be called to terminate
the library after its being re-initiated when the PredType destructors
were activated. This change removed the memory leaks shown by the
user's sample program.
- Added H5CPP_EXITED for PredType::AtExit to use as a flag
- Updated some inaccurate comments
- Removed stream functions from FileAccPropList
- Replaced H5_VMS with appropriate macro in H5IdComponent.cpp
- Corrected many URLs (hdfgroup vs. ncsa) in comments
- Replaced std::string with H5std_string in comments
Platforms tested:
Linux/32 2.6 (jam)
Linux/64 2.6 (amani)
SunOS 5.10 (linew)
Diffstat (limited to 'c++/src/H5PredType.h')
-rw-r--r-- | c++/src/H5PredType.h | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/c++/src/H5PredType.h b/c++/src/H5PredType.h index 69abfcb..9cb1c65 100644 --- a/c++/src/H5PredType.h +++ b/c++/src/H5PredType.h @@ -26,9 +26,17 @@ namespace H5 { #endif +/* This constant is defined for a workaround to eliminate memory leaks due to + the library being re-initiated when PredType destructors are invoked. A + PredType instant with H5CPP_EXITED as the value of its "id" is constructed + before the other PredType objects are created. At exit, when this special + PredType object is to be destructed, no HDF5 library function will be called + and the library will be terminated. -BMR, Mar 30, 2012 */ +#define H5CPP_EXITED -3 // -3 is less likely to be used elsewhere + class H5_DLLCPP PredType : public AtomType { public: - // Returns this class name + ///\brief Returns this class name virtual H5std_string fromClass () const { return("PredType"); } // Makes a copy of the predefined type and stores the new @@ -229,9 +237,10 @@ class H5_DLLCPP PredType : public AtomType { #endif // DOXYGEN_SHOULD_SKIP_THIS private: - // added this to work around the atexit/global destructor problem - // temporarily - it'll prevent the use of atexit to clean up - static const PredType NotAtexit; // not working yet + // Added this to work around the atexit/global destructor problem. + // It'll help to terminate the library after other PredType instances + // are closed. -BMR, Mar 30, 2012 + static const PredType AtExit; protected: #ifndef DOXYGEN_SHOULD_SKIP_THIS |