]> git.donarmstrong.com Git - mothur.git/commitdiff
fixed memory leak in rarefact
authorwestcott <westcott>
Thu, 14 May 2009 15:43:23 +0000 (15:43 +0000)
committerwestcott <westcott>
Thu, 14 May 2009 15:43:23 +0000 (15:43 +0000)
collect.cpp
collectcommand.cpp
collectsharedcommand.cpp
rarefact.cpp
rarefactcommand.cpp
rarefactsharedcommand.cpp

index ee46ef5928d8be156af4e1875304b633539e5147..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";
@@ -151,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";
index 098ec1f29539b28bb25fa928aedebf186351a96a..233b7bef963a22bdc0ab9a2e524699bc49e4366c 100644 (file)
@@ -126,6 +126,8 @@ int CollectCommand::execute(){
                        
                                cout << order->getLabel() << '\t' << count << endl;
                        }
+                       
+                       delete order;
                        order = (input->getOrderVector());
                        count++;
                }
index 86b35a5191d268452d86a2994dd1bcafd06a3001..06dbce79b1685a93c13c38f0b3906e6b8f7e9fe3 100644 (file)
@@ -155,6 +155,7 @@ int CollectSharedCommand::execute(){
                        }
                        
                        //get next line to process
+                       delete order;
                        order = input->getSharedOrderVector();
                        count++;
                }
index d7df01ea57d50d256ee9962939a527837d3beed1..cb4bbbce9a4047ae08b5f37b807be3f78c255d89 100644 (file)
@@ -52,11 +52,15 @@ void Rarefact::getCurve(int increment = 1, int nIters = 1000){
                        for(int i=0;i<displays.size();i++){
                                displays[i]->reset();
                        }
+                       
+                       delete lookup;
+                       delete rank;
                }
 
                for(int i=0;i<displays.size();i++){
                        displays[i]->close();
                }
+               delete rcd;
        }
        catch(exception& e) {
                cout << "Standard Error: " << e.what() << " has occurred in the Rarefact class Function getCurve. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
@@ -130,12 +134,17 @@ try {
                        for(int i=0;i<displays.size();i++){
                                displays[i]->reset();
                        }
+                       
+                       for (int i = 0; i < lookup.size(); i++) {
+                               delete lookup[i];
+                       }
                }
                
                for(int i=0;i<displays.size();i++){
                        displays[i]->close();
                }
-
+               
+               delete rcd;
        }
        catch(exception& e) {
                cout << "Standard Error: " << e.what() << " has occurred in the Rarefact class Function getSharedCurve. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
index 6e4197f7f8b4a9029709a9d4ab31f51c246d840b..981f077969b1e734b2dc39fb05b372daa2a5f455 100644 (file)
@@ -111,7 +111,8 @@ int RareFactCommand::execute(){
                        
                                cout << order->getLabel() << '\t' << count << endl;
                        }
-               
+                       
+                       delete order;
                        order = (input->getOrderVector());
                        count++;
                
index 29dd50e749dfa097d8ac16ac6181e58c559833a8..4a25cb3208f2695fc50308a8ff7df83deda163a8 100644 (file)
@@ -92,6 +92,7 @@ int RareFactSharedCommand::execute(){
                        }
                        
                        //get next line to process
+                       delete order;
                        order = input->getSharedOrderVector();
                        count++;
                }