]> git.donarmstrong.com Git - mothur.git/blobdiff - collect.cpp
fixed memory leak in rarefact
[mothur.git] / collect.cpp
index d109ca0540c01a78ca7e08c5c0e7bf6dfad85d90..76481d1739c2f652b60028c592aabe18d3d54736 100644 (file)
@@ -46,6 +46,10 @@ void Collect::getCurve(int increment = 1){
                 for(int i=0;i<displays.size();i++){
                         displays[i]->reset();
                 }
+                               
+                               delete lookup;
+                               delete rank;
+                               delete ccd;
         }
         catch(exception& e) {
                 cout << "Standard Error: " << e.what() << " has occurred in the Collect class Function getCurve. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
@@ -111,7 +115,9 @@ try {
        
                         //calculate at 0 and the given increment
                         if((i == 0) || (i+1) % increment == 0){
+
                                                                //how many comparisons to make i.e. for group a, b, c = ab, ac, bc.
+
                                 int n = 1;
                                 for (int k = 0; k < (lookup.size() - 1); k++) { // pass cdd each set of groups to commpare
                                         for (int l = n; l < lookup.size(); l++) {
@@ -149,6 +155,13 @@ try {
                 for(int i=0;i<displays.size();i++){
                         displays[i]->reset();
                 }
+                               
+                               //memory cleanup
+                               delete ccd;
+                               for (int i = 0; i < lookup.size(); i++) {
+                                       delete lookup[i];
+                               }
+
         }
         catch(exception& e) {
                 cout << "Standard Error: " << e.what() << " has occurred in the Collect class Function getSharedCurve. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";