summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2005-02-20 22:25:33 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2005-02-20 22:25:33 (GMT)
commitfe05afa043d3819d3e3d43ffaec17c85854fa501 (patch)
tree196a9feb15277976ea965cc77ebf36877836f30e
parent9027b5536e0ba07ccebd3a2a335030f39409f0f4 (diff)
downloadhdf5-fe05afa043d3819d3e3d43ffaec17c85854fa501.zip
hdf5-fe05afa043d3819d3e3d43ffaec17c85854fa501.tar.gz
hdf5-fe05afa043d3819d3e3d43ffaec17c85854fa501.tar.bz2
[svn-r10053] Purpose: Fix bugzilla #242
Description: In the release branch, RefCounter was still used for maintaining the reference count and there was a memory leak problem (bug 242) which is not a simple fix. Solution: Removed this reference counting approach completely and started using the C library's new APIs for that purpose. Platforms tested: Linux 2.4 (heping) SunOS 5.8 64-bit (sol)
-rw-r--r--c++/src/H5Idtemplates.h61
-rw-r--r--c++/src/H5RefCounter.cpp86
-rw-r--r--c++/src/H5RefCounter.h56
3 files changed, 0 insertions, 203 deletions
diff --git a/c++/src/H5Idtemplates.h b/c++/src/H5Idtemplates.h
deleted file mode 100644
index e070dd9..0000000
--- a/c++/src/H5Idtemplates.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// C++ informative line for the emacs editor: -*- C++ -*-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by the Board of Trustees of the University of Illinois. *
- * All rights reserved. *
- * *
- * This file is part of HDF5. The full HDF5 copyright notice, including *
- * terms governing use, modification, and redistribution, is contained in *
- * the files COPYING and Copyright.html. COPYING can be found at the root *
- * of the source code distribution tree; Copyright.html can be found at the *
- * root level of an installed copy of the electronic HDF5 document set and *
- * is linked from the top-level documents page. It can also be found at *
- * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
- * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-#ifndef _H5Idtemplates_h
-#define _H5Idtemplates_h
-
-#include "H5IdComponent.h"
-
-#ifndef H5_NO_NAMESPACE
-namespace H5 {
-#endif
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-//--------------------------------------------------------------------------
-// Function: resetIdComponent
-///\brief Resets the id of the passed-in object.
-///\param obj - IN: A "this" pointer of an IdComponent object
-///\exception H5::Exception's subclasses, thrown by p_close
-///\par Description:
-/// This function is used to reset an IdComponent object
-/// before using it again for another HDF5 object. If
-/// the member \a id is the valid id of an HDF5 object, which
-/// this IdComponent object represents, the associate close
-/// function will be called to properly close the HDF5 object.
-//
-// Note: Some older compilers don't support template member functions;
-// so at this time, resetIdComponent is not a member function so
-// it can be template to work around that problem.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-template <class Type>
-H5_DLLCPP void resetIdComponent(
- Type* obj ) // pointer to object to be reset
-{
- if( obj->noReference()) // ref count of this object is decremented here
- {
- if( obj->getId() > 0 )
- {
- obj->p_close(); // which p_close depends on whom this
- // IdComponent object belongs to
- }
- obj->reset(); // delete ref_count from IdComponent
- }
-}
-#endif // DOXYGEN_SHOULD_SKIP_THIS
-#ifndef H5_NO_NAMESPACE
-}
-#endif
-#endif
diff --git a/c++/src/H5RefCounter.cpp b/c++/src/H5RefCounter.cpp
deleted file mode 100644
index 860e1b5..0000000
--- a/c++/src/H5RefCounter.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by the Board of Trustees of the University of Illinois. *
- * All rights reserved. *
- * *
- * This file is part of HDF5. The full HDF5 copyright notice, including *
- * terms governing use, modification, and redistribution, is contained in *
- * the files COPYING and Copyright.html. COPYING can be found at the root *
- * of the source code distribution tree; Copyright.html can be found at the *
- * root level of an installed copy of the electronic HDF5 document set and *
- * is linked from the top-level documents page. It can also be found at *
- * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
- * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-#include "H5Include.h"
-#include "H5Exception.h"
-
-#ifndef H5_NO_NAMESPACE
-namespace H5 {
-#endif
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-//--------------------------------------------------------------------------
-// Function: RefCounter default constructor
-// Purpose Default constructor: Creates a reference counter and set it
-// to 1.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-RefCounter::RefCounter() : counter(1) {}
-
-//--------------------------------------------------------------------------
-// Function: RefCounter::getCounter
-// Purpose Returns the current value of the reference counter.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-int RefCounter::getCounter () const { return counter; }
-
-//--------------------------------------------------------------------------
-// Function: RefCounter::increment
-// Purpose Increments the reference counter.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void RefCounter::increment() { counter++; }
-
-//--------------------------------------------------------------------------
-// Function: RefCounter::decrement
-// Purpose Decrements the reference counter.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void RefCounter::decrement()
-{
- if (counter > 0)
- counter--;
- else
- throw IdComponentException("RefCounter::decrement",
- "reference counter of this object has non-positive value");
-}
-
-//--------------------------------------------------------------------------
-// Function: RefCounter::noReference
-// Purpose Returns true if there are no more reference to the object
-// that uses this counter.
-// Return true if there are no more reference to the object
-// that uses this counter, and false, otherwise.
-// Description
-// Decrements the reference counter then determines if there
-// are no more reference to the object that uses this counter.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-bool RefCounter::noReference()
-{
- if (counter > 0)
- counter--;
- return(counter <= 0 ? true:false);
-}
-
-//--------------------------------------------------------------------------
-// Function: RefCounter destructor
-// Purpose Noop destructor.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-RefCounter::~RefCounter() {}
-#endif // DOXYGEN_SHOULD_SKIP_THIS
-
-#ifndef H5_NO_NAMESPACE
-} // end namespace
-#endif
diff --git a/c++/src/H5RefCounter.h b/c++/src/H5RefCounter.h
deleted file mode 100644
index 9f05b7b..0000000
--- a/c++/src/H5RefCounter.h
+++ /dev/null
@@ -1,56 +0,0 @@
-// C++ informative line for the emacs editor: -*- C++ -*-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by the Board of Trustees of the University of Illinois. *
- * All rights reserved. *
- * *
- * This file is part of HDF5. The full HDF5 copyright notice, including *
- * terms governing use, modification, and redistribution, is contained in *
- * the files COPYING and Copyright.html. COPYING can be found at the root *
- * of the source code distribution tree; Copyright.html can be found at the *
- * root level of an installed copy of the electronic HDF5 document set and *
- * is linked from the top-level documents page. It can also be found at *
- * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
- * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-#ifndef _H5RefCounter_H
-#define _H5RefCounter_H
-
-
-#ifndef H5_NO_NAMESPACE
-namespace H5 {
-#endif
-
-///\remarks The features provided by this class are now handled at
-/// the C library layer; thus, the class will be removed from
-/// future releases.
-
-class H5_DLLCPP RefCounter {
- public:
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Returns the current value of the reference counter.
- int getCounter () const;
-
- // Increments the reference counter.
- void increment();
-
- // Decrements the reference counter.
- void decrement();
-
- // This function is used to determine whether to close an
- // HDF5 object when there are no more reference to that object.
- bool noReference();
-
- // Creates a reference counter to be used by an HDF5 object.
- RefCounter();
-
- ~RefCounter();
-#endif // DOXYGEN_SHOULD_SKIP_THIS
-
- private:
- int counter; // keeps track of number of copies of an object
-};
-#ifndef H5_NO_NAMESPACE
-}
-#endif
-#endif