]> git.donarmstrong.com Git - mothur.git/blobdiff - venncommand.cpp
speed up rarefaction.shared
[mothur.git] / venncommand.cpp
index e9cb47aca2c0b6291cbf57902ceb56808137704e..a934126a944513a427f1c202a9a81bec93053a21 100644 (file)
@@ -80,6 +80,7 @@ VennCommand::~VennCommand(){
        delete input;
        delete read;
        delete venn;
+       for (int i = 0; i < vennCalculators.size(); i++) {      delete vennCalculators[i];      }
 }
 
 //**********************************************************************************************************************
@@ -98,14 +99,6 @@ int VennCommand::execute(){
                        
                        input = globaldata->ginput;
                        lookup = input->getSharedRAbundVectors();
-               }else if (format == "shared") {
-                       //you are using a list and a groupfile
-                       read = new ReadOTUFile(globaldata->inputFileName);      
-                       read->read(&*globaldata); 
-               
-                       input = globaldata->ginput;
-                       SharedList = globaldata->gSharedList;
-                       lookup = SharedList->getSharedRAbundVector();
                }else if (format == "list") {
                        //you are using just a list file and have only one group
                        read = new ReadOTUFile(globaldata->inputFileName);      
@@ -132,7 +125,10 @@ int VennCommand::execute(){
                                        //util->getSharedVectors(globaldata->Groups, lookup, order);  //fills group vectors from order vector.
                                        venn->getPic(lookup, vennCalculators);
                                }
-                                               
+                               
+                               //prevent memory leak
+                               for (int i = 0; i < lookup.size(); i++) {       delete lookup[i];       }
+                               
                                //get next line to process
                                lookup = input->getSharedRAbundVectors();
                                count++;
@@ -151,6 +147,7 @@ int VennCommand::execute(){
                                        venn->getPic(sabund, vennCalculators);
                                }
                                
+                               delete sabund;
                                sabund = input->getSAbundVector();
                                count++;
                        }