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

fixes #23742; setLen(0) no longer allocates memory for uninitialized strs/seqs for refc #23745

Merged
merged 1 commit into from
Jun 21, 2024

Conversation

ringabout
Copy link
Member

@ringabout ringabout commented Jun 20, 2024

fixes #23742

Before my PR, setLen(0) doesn't free buffer if s != nil, but it allocated unnecessary memory for strs. This PR rectifies this behavior. setLen(0) no longer allocates memory for uninitialized strs/seqs

@ringabout ringabout changed the title fixes #23742; setLen(0) no longer allocates memory for uninitialized strs/seqs fixes #23742; setLen(0) no longer allocates memory for uninitialized strs/seqs for refc Jun 20, 2024
@Araq Araq merged commit 2bef087 into devel Jun 21, 2024
22 checks passed
@Araq Araq deleted the pr_avoid_alloc_set_len branch June 21, 2024 13:07
Copy link
Contributor

Thanks for your hard work on this PR!
The lines below are statistics of the Nim compiler built from 2bef087

Hint: mm: orc; opt: speed; options: -d:release
179014 lines; 8.531s; 664.309MiB peakmem

narimiran pushed a commit that referenced this pull request Jun 24, 2024
…strs/seqs for refc (#23745)

fixes #23742

Before my PR, `setLen(0)` doesn't free buffer if `s != nil`, but it
allocated unnecessary memory for `strs`. This PR rectifies this
behavior. `setLen(0)` no longer allocates memory for uninitialized
strs/seqs

(cherry picked from commit 2bef087)
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.

setLen(0) allocates memory causing performance regression
2 participants