Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
5b248341
Commit
5b248341
authored
Jun 20, 2019
by
Guolin Ke
Browse files
avoid the bad_alloc when overflow.
parent
cdba7147
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
0 deletions
+2
-0
src/io/dataset_loader.cpp
src/io/dataset_loader.cpp
+2
-0
No files found.
src/io/dataset_loader.cpp
View file @
5b248341
...
@@ -615,6 +615,7 @@ Dataset* DatasetLoader::CostructFromSampleData(double** sample_values,
...
@@ -615,6 +615,7 @@ Dataset* DatasetLoader::CostructFromSampleData(double** sample_values,
int
type_size
=
BinMapper
::
SizeForSpecificBin
(
max_bin
);
int
type_size
=
BinMapper
::
SizeForSpecificBin
(
max_bin
);
// since sizes of different feature may not be same, we expand all bin mapper to type_size
// since sizes of different feature may not be same, we expand all bin mapper to type_size
comm_size_t
buffer_size
=
type_size
*
total_num_feature
;
comm_size_t
buffer_size
=
type_size
*
total_num_feature
;
CHECK
(
buffer_size
>=
0
);
auto
input_buffer
=
std
::
vector
<
char
>
(
buffer_size
);
auto
input_buffer
=
std
::
vector
<
char
>
(
buffer_size
);
auto
output_buffer
=
std
::
vector
<
char
>
(
buffer_size
);
auto
output_buffer
=
std
::
vector
<
char
>
(
buffer_size
);
...
@@ -917,6 +918,7 @@ void DatasetLoader::ConstructBinMappersFromTextData(int rank, int num_machines,
...
@@ -917,6 +918,7 @@ void DatasetLoader::ConstructBinMappersFromTextData(int rank, int num_machines,
int
type_size
=
BinMapper
::
SizeForSpecificBin
(
max_bin
);
int
type_size
=
BinMapper
::
SizeForSpecificBin
(
max_bin
);
// since sizes of different feature may not be same, we expand all bin mapper to type_size
// since sizes of different feature may not be same, we expand all bin mapper to type_size
comm_size_t
buffer_size
=
type_size
*
num_total_features
;
comm_size_t
buffer_size
=
type_size
*
num_total_features
;
CHECK
(
buffer_size
>=
0
);
auto
input_buffer
=
std
::
vector
<
char
>
(
buffer_size
);
auto
input_buffer
=
std
::
vector
<
char
>
(
buffer_size
);
auto
output_buffer
=
std
::
vector
<
char
>
(
buffer_size
);
auto
output_buffer
=
std
::
vector
<
char
>
(
buffer_size
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment