From fba9e5c7145c7d97125cf594b05a82097c2dfd04 Mon Sep 17 00:00:00 2001 From: tqchen Date: Sun, 5 Apr 2015 12:01:19 -0700 Subject: [PATCH] quick fix --- src/gbm/gbtree-inl.hpp | 6 +++++- src/io/dmlc_simple.cpp | 3 ++- src/io/simple_fmatrix-inl.hpp | 6 ++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/gbm/gbtree-inl.hpp b/src/gbm/gbtree-inl.hpp index d2ff2358b..8e2627f86 100644 --- a/src/gbm/gbtree-inl.hpp +++ b/src/gbm/gbtree-inl.hpp @@ -206,6 +206,10 @@ class GBTree : public IGradBooster { for (size_t i = 0; i < trees.size(); ++i) { delete trees[i]; } + for (size_t i = 0; i < updaters.size(); ++i) { + delete updaters[i]; + } + updaters.clear(); trees.clear(); pred_buffer.clear(); pred_counter.clear(); @@ -444,12 +448,12 @@ class GBTree : public IGradBooster { int reserved[31]; /*! \brief constructor */ ModelParam(void) { + std::memset(this, 0, sizeof(ModelParam)); num_trees = 0; num_roots = num_feature = 0; num_pbuffer = 0; num_output_group = 1; size_leaf_vector = 0; - std::memset(reserved, 0, sizeof(reserved)); } /*! * \brief set parameters from outside diff --git a/src/io/dmlc_simple.cpp b/src/io/dmlc_simple.cpp index 4d4580fcf..a97e99993 100644 --- a/src/io/dmlc_simple.cpp +++ b/src/io/dmlc_simple.cpp @@ -10,7 +10,8 @@ namespace xgboost { namespace utils { class SingleFileSplit : public dmlc::InputSplit { public: - explicit SingleFileSplit(const char *fname) { + explicit SingleFileSplit(const char *fname) + : use_stdin_(false) { if (!std::strcmp(fname, "stdin")) { #ifndef XGBOOST_STRICT_CXX98_ use_stdin_ = true; fp_ = stdin; diff --git a/src/io/simple_fmatrix-inl.hpp b/src/io/simple_fmatrix-inl.hpp index 08e25e28b..21279900f 100644 --- a/src/io/simple_fmatrix-inl.hpp +++ b/src/io/simple_fmatrix-inl.hpp @@ -192,8 +192,10 @@ class FMatrixS : public IFMatrix{ bst_omp_uint ncol = static_cast(this->NumCol()); #pragma omp parallel for schedule(static) for (bst_omp_uint i = 0; i < ncol; ++i) { - std::sort(&col_data_[0] + col_ptr_[i], - &col_data_[0] + col_ptr_[i + 1], Entry::CmpValue); + if (col_ptr_[i] < col_ptr_[i + 1]) { + std::sort(BeginPtr(col_data_) + col_ptr_[i], + BeginPtr(col_data_) + col_ptr_[i + 1], Entry::CmpValue); + } } }