From: westcott Date: Thu, 14 May 2009 15:43:23 +0000 (+0000) Subject: fixed memory leak in rarefact X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=commitdiff_plain;h=599af78a6ea4916919d460a131e2d0dffa28d35e fixed memory leak in rarefact --- diff --git a/collect.cpp b/collect.cpp index ee46ef5..76481d1 100644 --- a/collect.cpp +++ b/collect.cpp @@ -46,6 +46,10 @@ void Collect::getCurve(int increment = 1){ for(int i=0;ireset(); } + + 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;ireset(); } + + //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"; diff --git a/collectcommand.cpp b/collectcommand.cpp index 098ec1f..233b7be 100644 --- a/collectcommand.cpp +++ b/collectcommand.cpp @@ -126,6 +126,8 @@ int CollectCommand::execute(){ cout << order->getLabel() << '\t' << count << endl; } + + delete order; order = (input->getOrderVector()); count++; } diff --git a/collectsharedcommand.cpp b/collectsharedcommand.cpp index 86b35a5..06dbce7 100644 --- a/collectsharedcommand.cpp +++ b/collectsharedcommand.cpp @@ -155,6 +155,7 @@ int CollectSharedCommand::execute(){ } //get next line to process + delete order; order = input->getSharedOrderVector(); count++; } diff --git a/rarefact.cpp b/rarefact.cpp index d7df01e..cb4bbbc 100644 --- a/rarefact.cpp +++ b/rarefact.cpp @@ -52,11 +52,15 @@ void Rarefact::getCurve(int increment = 1, int nIters = 1000){ for(int i=0;ireset(); } + + delete lookup; + delete rank; } for(int i=0;iclose(); } + 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;ireset(); } + + for (int i = 0; i < lookup.size(); i++) { + delete lookup[i]; + } } for(int i=0;iclose(); } - + + 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"; diff --git a/rarefactcommand.cpp b/rarefactcommand.cpp index 6e4197f..981f077 100644 --- a/rarefactcommand.cpp +++ b/rarefactcommand.cpp @@ -111,7 +111,8 @@ int RareFactCommand::execute(){ cout << order->getLabel() << '\t' << count << endl; } - + + delete order; order = (input->getOrderVector()); count++; diff --git a/rarefactsharedcommand.cpp b/rarefactsharedcommand.cpp index 29dd50e..4a25cb3 100644 --- a/rarefactsharedcommand.cpp +++ b/rarefactsharedcommand.cpp @@ -92,6 +92,7 @@ int RareFactSharedCommand::execute(){ } //get next line to process + delete order; order = input->getSharedOrderVector(); count++; }