From c67c33e267ff447dcaa34ec29dc50618fd162045 Mon Sep 17 00:00:00 2001 From: Dongryeol Lee Date: Fri, 2 May 2008 16:49:00 +0000 Subject: [PATCH] Fixed memory leak error --- fastlib2/mlpack/kde/dualtree_kde.h | 16 +++++++++------- fastlib2/mlpack/kde/kde.h | 14 ++++++++------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/fastlib2/mlpack/kde/dualtree_kde.h b/fastlib2/mlpack/kde/dualtree_kde.h index 69c56a959c..552e1e8d0e 100644 --- a/fastlib2/mlpack/kde/dualtree_kde.h +++ b/fastlib2/mlpack/kde/dualtree_kde.h @@ -637,14 +637,16 @@ class DualtreeKde { */ void PreProcess(Tree *node) { - // initialize the center of expansions and bandwidth for - // series expansion + // Initialize the center of expansions and bandwidth for series + // expansion. + Vector bounding_box_center; node->stat().Init(ka_); - node->bound().CalculateMidpoint - (node->stat().farfield_expansion_.get_center()); - node->bound().CalculateMidpoint - (node->stat().local_expansion_.get_center()); - + node->bound().CalculateMidpoint(&bounding_box_center); + (node->stat().farfield_expansion_.get_center())->CopyValues + (bounding_box_center); + (node->stat().local_expansion_.get_center())->CopyValues + (bounding_box_center); + // initialize lower bound to 0 node->stat().mass_l_ = 0; diff --git a/fastlib2/mlpack/kde/kde.h b/fastlib2/mlpack/kde/kde.h index 3c03636d04..a298360926 100644 --- a/fastlib2/mlpack/kde/kde.h +++ b/fastlib2/mlpack/kde/kde.h @@ -855,13 +855,15 @@ class FastKde { */ void PreProcess(Tree *node) { - // initialize the center of expansions and bandwidth for - // series expansion + // Initialize the center of expansions and bandwidth for series + // expansion. + Vector bounding_box_center; node->stat().Init(parameters_.ka_); - node->bound().CalculateMidpoint - (node->stat().farfield_expansion_.get_center()); - node->bound().CalculateMidpoint - (node->stat().local_expansion_.get_center()); + node->bound().CalculateMidpoint(&bounding_box_center); + (node->stat().farfield_expansion_.get_center())->CopyValues + (bounding_box_center); + (node->stat().local_expansion_.get_center())->CopyValues + (bounding_box_center); // reset summary result and postponed information node->stat().summary_result_.Init(parameters_);