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

[OP-2240] bugfix: Fix reused memory on long files #29

Merged
merged 4 commits into from
Dec 18, 2023

Conversation

applejag
Copy link
Member

@applejag applejag commented Dec 11, 2023

OP-2240

Jelease failed on longer files.

Bug was that the code was using the value from Scanner.Bytes, which gives you a slice to some underlying array that may change between scanning iterations.

This bug was not visible on shorter files because the scanner/OS loads the file in chunks. Smaller files just happen to fit into the initial chunk.

The code could be optimized to not do this scanning first and iteration later, but to keep the PR small I just introduced a simple slices.Clone.

@applejag applejag requested a review from a team as a code owner December 11, 2023 11:07
@applejag applejag requested review from nicmr and removed request for a team December 11, 2023 11:07
@applejag applejag added the bug Something isn't working label Dec 11, 2023
@applejag applejag self-assigned this Dec 11, 2023
@applejag applejag changed the title bugfix: Fix reused memory on long files [OP-2240] bugfix: Fix reused memory on long files Dec 11, 2023
Copy link
Member

@jadolg jadolg left a comment

Choose a reason for hiding this comment

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

This is the kind of things we should be writing tests for

@applejag applejag merged commit c263246 into main Dec 18, 2023
4 checks passed
@applejag applejag deleted the bugfix/fix-copy-on-long-files branch December 18, 2023 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants