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

How to reuse once allocated space #16

Closed
l4l opened this issue Oct 21, 2024 · 0 comments · Fixed by #17
Closed

How to reuse once allocated space #16

l4l opened this issue Oct 21, 2024 · 0 comments · Fixed by #17

Comments

@l4l
Copy link
Contributor

l4l commented Oct 21, 2024

I have a use case like this:

loop {
  let mut vec = boxcar::Vec::with_capacity(WELL_KNOWN_UPPER_LIMIT);

  // ..

  concurrently_append_updates(&mut vec);

  // ..

  let some_data = vec.iter().fold(..);
}

so in the end of the loop I want to reuse the memory and avoid dealloc-alloc on each iteration. Don't see anything suitable exposed in the api. Perhaps Vec::reset(self) -> Self could work?

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 a pull request may close this issue.

1 participant