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 excessive memory usage for Rust 1.76 #331

Merged
merged 1 commit into from
Jan 24, 2024

Conversation

atuchin-m
Copy link
Collaborator

For cr121 we started to use 1.76 rust with a in-place iteration issue that results in excessive memory consumption.
rustc 1.76.0-dev (df0295f07175acc7325ce3ca4152eb05752af1f2-3-llvmorg-18-init-12938-geb1d5065 chromium)

This PR fixes the most critical code path that reduces the memory to about the original size.

Copy link
Collaborator

@antonok-edm antonok-edm left a comment

Choose a reason for hiding this comment

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

@atuchin-m does it make sense to move it to line 807, next to the other shrink_to_fit?

@atuchin-m
Copy link
Collaborator Author

@antonok-edm we need to call shrink_to_fit() for each key-value we add to the map.

And we can't do it after. In that case the map takes already much more memory that we need to. That affect peak memory usage and create extra work to alloc and to free after.

With local allocs/deallocs I suppose PartAlloc cache could bear them without much using OS-level alloc.

@antonok-edm antonok-edm merged commit b7ed8f8 into master Jan 24, 2024
7 checks passed
@antonok-edm antonok-edm deleted the workaround-for-rust-memory-issue branch January 24, 2024 22:10
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.

2 participants