Quick fix for memory leak in CPU Hist. (#5153)
Closes https://github.com/dmlc/xgboost/issues/3579 . * Don't use map.
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include "../../../src/tree/param.h"
|
||||
#include "../../../src/tree/updater_quantile_hist.h"
|
||||
#include "../../../src/tree/split_evaluator.h"
|
||||
#include "xgboost/data.h"
|
||||
|
||||
namespace xgboost {
|
||||
namespace tree {
|
||||
@@ -26,8 +27,9 @@ class QuantileHistMock : public QuantileHistMaker {
|
||||
BuilderMock(const TrainParam& param,
|
||||
std::unique_ptr<TreeUpdater> pruner,
|
||||
std::unique_ptr<SplitEvaluator> spliteval,
|
||||
FeatureInteractionConstraintHost int_constraint)
|
||||
: RealImpl(param, std::move(pruner), std::move(spliteval), std::move(int_constraint)) {}
|
||||
FeatureInteractionConstraintHost int_constraint,
|
||||
DMatrix const* fmat)
|
||||
: RealImpl(param, std::move(pruner), std::move(spliteval), std::move(int_constraint), fmat) {}
|
||||
|
||||
public:
|
||||
void TestInitData(const GHistIndexMatrix& gmat,
|
||||
@@ -236,13 +238,14 @@ class QuantileHistMock : public QuantileHistMaker {
|
||||
cfg_{args} {
|
||||
QuantileHistMaker::Configure(args);
|
||||
spliteval_->Init(¶m_);
|
||||
dmat_ = CreateDMatrix(kNRows, kNCols, 0.8, 3);
|
||||
builder_.reset(
|
||||
new BuilderMock(
|
||||
param_,
|
||||
std::move(pruner_),
|
||||
std::unique_ptr<SplitEvaluator>(spliteval_->GetHostClone()),
|
||||
int_constraint_));
|
||||
dmat_ = CreateDMatrix(kNRows, kNCols, 0.8, 3);
|
||||
int_constraint_,
|
||||
dmat_->get()));
|
||||
}
|
||||
~QuantileHistMock() override { delete dmat_; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user