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

Memory leaks #354

Open
Smotrov opened this issue Feb 14, 2024 · 2 comments
Open

Memory leaks #354

Smotrov opened this issue Feb 14, 2024 · 2 comments

Comments

@Smotrov
Copy link

Smotrov commented Feb 14, 2024

I know it is always strange to talk about memory leaks in Rust.
But anyway...
My app is constantly working with queue of tar files with about 10K entries.
And the memory used is slowly growing over time for no reason.
After investigation with Xcode instruments it showed that there is a memory leak on the very simple line
entry.read_to_end(&mut buff_vec)?;

Has anybody faced the same problem?
Знімок екрана 2024-02-14 о 12 14 13
Any ideas how to address that?

@NobodyXu
Copy link

Add buff_vec.shrink_to_fit() before inserting into the HashMap, it would remove the unused capacity in the Vec reserved (to achieve amortised O(1) push).

@Smotrov
Copy link
Author

Smotrov commented Feb 14, 2024

Add buff_vec.shrink_to_fit() before inserting into the HashMap, it would remove the unused capacity in the Vec reserved (to achieve amortised O(1) push).

Thank you. Unfortunately does not helps.

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

No branches or pull requests

2 participants