Add travis sanitizers tests. (#3557)
* Add travis sanitizers tests. * Add gcc-7 in Travis. * Add SANITIZER_PATH for CMake. * Enable sanitizer tests in Travis. * Fix memory leaks in tests. * Fix all memory leaks reported by Address Sanitizer. * tests/cpp/helpers.h/CreateDMatrix now returns raw pointer.
This commit is contained in:
committed by
Rory Mitchell
parent
983cb0b374
commit
cf2d86a4f6
@@ -107,8 +107,8 @@ xgboost::bst_float GetMetricEval(xgboost::Metric * metric,
|
||||
return metric->Eval(preds, info, false);
|
||||
}
|
||||
|
||||
std::shared_ptr<xgboost::DMatrix> CreateDMatrix(int rows, int columns,
|
||||
float sparsity, int seed) {
|
||||
std::shared_ptr<xgboost::DMatrix>* CreateDMatrix(int rows, int columns,
|
||||
float sparsity, int seed) {
|
||||
const float missing_value = -1;
|
||||
std::vector<float> test_data(rows * columns);
|
||||
std::mt19937 gen(seed);
|
||||
@@ -124,5 +124,5 @@ std::shared_ptr<xgboost::DMatrix> CreateDMatrix(int rows, int columns,
|
||||
DMatrixHandle handle;
|
||||
XGDMatrixCreateFromMat(test_data.data(), rows, columns, missing_value,
|
||||
&handle);
|
||||
return *static_cast<std::shared_ptr<xgboost::DMatrix> *>(handle);
|
||||
return static_cast<std::shared_ptr<xgboost::DMatrix> *>(handle);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user