Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash when saving a Frame to CSV #1279

Merged
merged 2 commits into from
Sep 8, 2018
Merged

Fix crash when saving a Frame to CSV #1279

merged 2 commits into from
Sep 8, 2018

Conversation

st-pasha
Copy link
Contributor

@st-pasha st-pasha commented Sep 7, 2018

The crash came because of mis-estimating the line length (forgot to account for the separators).

Closes #1278

@st-pasha st-pasha self-assigned this Sep 7, 2018
@@ -464,6 +464,7 @@ size_t CsvWriter::estimate_output_size()
size_t ncols = static_cast<size_t>(dt->ncols);
size_t total_string_size = 0;
size_t total_columns_size = 0;
fixed_size_per_row = ncols; // 1 byte per separator
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also need to add 1 byte for \n?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are ncols-1 separators + 1 newline, ncols bytes in total.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, for some reason thought we have an additional separator at the end.

@st-pasha st-pasha merged commit 4195778 into master Sep 8, 2018
@st-pasha st-pasha deleted the tocsv-crash branch September 8, 2018 00:10
abal5 pushed a commit that referenced this pull request Sep 13, 2018
* Fix crash when saving a Frame to CSV
* Do not spawn more threads than the number of chunks
@st-pasha st-pasha added this to the Release 0.7.0 milestone Jan 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

.to_csv() crashes for a file with many boolean columns
2 participants