[linbox] New -destructor patch that doesn't cause memory leaks.

Jerry James jjames at fedoraproject.org
Wed Nov 9 21:56:25 UTC 2011


commit 7796309d910773aabde49a2a82795af1bff8ccd5
Author: Jerry James <loganjerry at gmail.com>
Date:   Wed Nov 9 14:56:14 2011 -0700

    New -destructor patch that doesn't cause memory leaks.

 linbox-destructor.patch |   90 -----------------------------------------------
 linbox.spec             |    5 ++-
 2 files changed, 4 insertions(+), 91 deletions(-)
---
diff --git a/linbox-destructor.patch b/linbox-destructor.patch
index ca935a1..398d5ad 100644
--- a/linbox-destructor.patch
+++ b/linbox-destructor.patch
@@ -28,93 +28,3 @@
  #include "test-common.C"
  #endif
  #endif // __LINBOX_test_common_H
---- ./linbox/util/commentator.h.orig	2011-10-28 02:48:12.000000000 -0600
-+++ ./linbox/util/commentator.h	2011-11-07 15:53:16.245345208 -0700
-@@ -156,12 +156,6 @@ namespace LinBox
- 		Commentator ();
- 		Commentator (std::ostream&);
- 
--
--		/** @internal
--		 * Default destructor.
--		*/
--		virtual ~Commentator ();
--
- 		/**@internal
- 		 * @name Reporting facilities.
- 		 * @{
-@@ -844,8 +838,6 @@ namespace LinBox
- 		inline Commentator () :
- 			cnull ("/dev/null")
- 		{}
--		inline  ~Commentator ()
--	       	{}
- 		inline void start (const char *, const char * = (const char *) 0, unsigned long = 0)
- 	       	{}
- 		inline void startIteration (unsigned int , unsigned long = 0)
---- ./linbox/util/commentator.C.orig	2011-10-28 02:48:12.000000000 -0600
-+++ ./linbox/util/commentator.C	2011-11-07 15:52:47.781343894 -0700
-@@ -119,17 +119,6 @@ namespace LinBox
- 		registerMessageClass (INTERNAL_DESCRIPTION, _report);
- 	}
- 
--	Commentator::~Commentator()
--	{
--		std::map <const char *, MessageClass *, C_str_Less >::iterator i;
--		for (i = _messageClasses.begin (); i != _messageClasses.end (); ++i)
--			delete i->second;
--		while (!_activities.empty()){
--			delete _activities.top();
--			_activities.pop();
--		}
--	}
--
- 	void Commentator::start (const char *description, const char *fn, unsigned long len)
- 	{
- 		if (fn == (const char *) 0 && _activities.size () > 0)
-@@ -193,14 +182,12 @@ namespace LinBox
- 
- 		fn = top_act->_fn;
- 
--		_activities.pop ();
--
--		if (isPrinted (_activities.size (), LEVEL_IMPORTANT, BRIEF_REPORT, fn))
-+		if (isPrinted (_activities.size () - 1, LEVEL_IMPORTANT, BRIEF_REPORT, fn))
- 		{
- 			finishActivityReport (*top_act, msg);
- 		}
- 
--		if (isPrinted (_activities.size () + 1, LEVEL_IMPORTANT, INTERNAL_DESCRIPTION, fn)) {
-+		if (isPrinted (_activities.size (), LEVEL_IMPORTANT, INTERNAL_DESCRIPTION, fn)) {
- 			std::ostream &output = report (LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
- 			output.precision (4);
- 			output << "Finished activity (rea: " << realtime << "s, cpu: ";
-@@ -209,7 +196,7 @@ namespace LinBox
- 			output.precision (4);
- 			output << systime << "s): " << long_msg << std::endl;
- 		}
--		else if (isPrinted (_activities.size (), LEVEL_IMPORTANT, INTERNAL_DESCRIPTION, fn)) {
-+		else if (isPrinted (_activities.size () - 1, LEVEL_IMPORTANT, INTERNAL_DESCRIPTION, fn)) {
- 			std::ostream &output = report (LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
- 			output.precision (4);
- 			output << "Completed activity: " << top_act->_desc << " (r: " << realtime << "s, u: ";
-@@ -219,7 +206,7 @@ namespace LinBox
- 			output << systime << "s) " << long_msg << std::endl;
- 		}
- 
--		delete top_act;
-+		_activities.pop ();
- 	}
- 
- 	void Commentator::progress (long k, long len)
-@@ -395,10 +382,7 @@ namespace LinBox
- 	void Commentator::setMessageClassStream (const char *msg_class, std::ostream &stream)
- 	{
- 		//temporarily fixed the bug in test-commentator, left memory leaking.
--		MessageClass *old_msg_class = _messageClasses[msg_class];
- 		cloneMessageClass (msg_class, msg_class, stream);
--		delete old_msg_class;
--
- 	}
- 
- 	void Commentator::setDefaultReportFile (const char *filename)
diff --git a/linbox.spec b/linbox.spec
index 5496e4e..77c80aa 100644
--- a/linbox.spec
+++ b/linbox.spec
@@ -1,6 +1,6 @@
 Name:           linbox
 Version:        1.2.2
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        C++ Library for High-Performance Exact Linear Algebra
 Group:          Development/Libraries
 License:        LGPLv2+
@@ -117,6 +117,9 @@ LD_LIBRARY_PATH=`pwd`/linbox/.libs make %{?_smp_mflags} check
 
 
 %changelog
+* Wed Nov  9 2011 Jerry James <loganjerry at gmail.com> - 1.2.2-2
+- New -destructor patch that doesn't cause memory leaks
+
 * Tue Nov  1 2011 Jerry James <loganjerry at gmail.com> - 1.2.2-1
 - Update to new upstream release
 - Reenable the tests


More information about the scm-commits mailing list