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

Use ManuallyDrop better rather than StringToFree #193

Merged
merged 1 commit into from
Oct 23, 2024

Conversation

waywardmonkeys
Copy link
Contributor

Instead of storing string raw parts and re-creating them, we can use ManuallyDrop<T> instead.

Also, various builders were dropping the term builder string parts, but not clearing the vec, so if they were incorrectly used multiple times, they would have deallocated the same memory multiple times.

This also makes the fact that strings are being dropped more explicit (by calls to ManuallyDrop::drop rather than the implicit drop from String::from_raw_parts).

This will let us use compact_str in these places in the future.

This is an incremental change. Future commits will continue to improve upon this.

Instead of storing string raw parts and re-creating them, we can
use `ManuallyDrop<T>` instead.

Also, various builders were dropping the term builder string
parts, but not clearing the vec, so if they were incorrectly
used multiple times, they would have deallocated the same
memory multiple times.

This also makes the fact that strings are being dropped more
explicit (by calls to `ManuallyDrop::drop` rather than the
implicit drop from `String::from_raw_parts`).

This will let us use `compact_str` in these places in the future.

This is an incremental change. Future commits will continue to
improve upon this.
@waywardmonkeys waywardmonkeys marked this pull request as ready for review October 23, 2024 08:36
@Indra-db Indra-db merged commit 947b976 into Indra-db:main Oct 23, 2024
9 checks passed
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