activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r902107 - /activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/PriorityQueue.h
Date Fri, 22 Jan 2010 14:55:01 GMT
Author: tabish
Date: Fri Jan 22 14:55:00 2010
New Revision: 902107

URL: http://svn.apache.org/viewvc?rev=902107&view=rev
Log:
Fix some memory leaks in the PriorityQueue

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/PriorityQueue.h

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/PriorityQueue.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/PriorityQueue.h?rev=902107&r1=902106&r2=902107&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/PriorityQueue.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/PriorityQueue.h Fri Jan 22
14:55:00 2010
@@ -206,7 +206,9 @@
             this->getFromPriorityQueue( source );
         }
 
-        virtual ~PriorityQueue() {}
+        virtual ~PriorityQueue() {
+            delete [] elements;
+        }
 
         /**
          * Assignment operator, assign another Collection to this one.
@@ -246,6 +248,9 @@
             // TODO - Provide a more efficient way to clear the array without reallocating
it
             //        we should keep the size it grew to since if reused it could get that
big
             //        again and reallocating all that memory could be to slow.
+
+            delete [] this->elements;
+
             this->elements = new E[DEFAULT_CAPACITY];
             this->capacity = DEFAULT_CAPACITY;
             this->_size = 0;



Mime
View raw message