[mlpack-git] master: Fix glaringly obvious memory leaks. (897499b)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Sun Apr 26 20:34:22 EDT 2015


Repository : https://github.com/mlpack/mlpack

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/59a05b837daaec4678157beadf7783c7067ff607...fbdc8d44bcdb3a9f174b6f9a8839ced81b20f98f

>---------------------------------------------------------------

commit 897499b7db3519d64b346856405af30cca6cf0ca
Author: ryan <ryan at ratml.org>
Date:   Sun Apr 26 20:19:02 2015 -0400

    Fix glaringly obvious memory leaks.


>---------------------------------------------------------------

897499b7db3519d64b346856405af30cca6cf0ca
 src/mlpack/methods/neighbor_search/neighbor_search_impl.hpp | 2 ++
 src/mlpack/methods/rann/ra_search_impl.hpp                  | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/src/mlpack/methods/neighbor_search/neighbor_search_impl.hpp b/src/mlpack/methods/neighbor_search/neighbor_search_impl.hpp
index 5a1c3c6..803f0f4 100644
--- a/src/mlpack/methods/neighbor_search/neighbor_search_impl.hpp
+++ b/src/mlpack/methods/neighbor_search/neighbor_search_impl.hpp
@@ -201,6 +201,8 @@ void NeighborSearch<SortPolicy, MetricType, TreeType>::Search(
 
     Log::Info << rules.Scores() << " node combinations were scored.\n";
     Log::Info << rules.BaseCases() << " base cases were calculated.\n";
+
+    delete queryTree;
   }
 
   Timer::Stop("computing_neighbors");
diff --git a/src/mlpack/methods/rann/ra_search_impl.hpp b/src/mlpack/methods/rann/ra_search_impl.hpp
index aca7460..b0db731 100644
--- a/src/mlpack/methods/rann/ra_search_impl.hpp
+++ b/src/mlpack/methods/rann/ra_search_impl.hpp
@@ -238,6 +238,8 @@ Search(const typename TreeType::Mat& querySet,
     Log::Info << "Dual-tree traversal complete." << std::endl;
     Log::Info << "Average number of distance calculations per query point: "
         << (rules.NumDistComputations() / querySet.n_cols) << "." << std::endl;
+
+    delete queryTree;
   }
 
   Timer::Stop("computing_neighbors");



More information about the mlpack-git mailing list