Fix memory leak in XGDMatrixCreateFromMat_omp() (#3182)
* Fix memory leak in XGDMatrixCreateFromMat_omp() This replaces the array allocated by new with a std::vector. Fixes #3161
This commit is contained in:
parent
c85995952f
commit
00d9728e4b
@ -452,11 +452,8 @@ XGB_DLL int XGDMatrixCreateFromMat_omp(const bst_float* data,
|
|||||||
// Check for errors in missing elements
|
// Check for errors in missing elements
|
||||||
// Count elements per row (to avoid otherwise need to copy)
|
// Count elements per row (to avoid otherwise need to copy)
|
||||||
bool nan_missing = common::CheckNAN(missing);
|
bool nan_missing = common::CheckNAN(missing);
|
||||||
int *badnan;
|
std::vector<int> badnan;
|
||||||
badnan = new int[nthread];
|
badnan.resize(nthread, 0);
|
||||||
for (int i = 0; i < nthread; i++) {
|
|
||||||
badnan[i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma omp parallel num_threads(nthread)
|
#pragma omp parallel num_threads(nthread)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user