-
Notifications
You must be signed in to change notification settings - Fork 835
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
Add Global deallocation variant (#3516) #3517
Conversation
@@ -135,20 +135,25 @@ pub(crate) enum Deallocation { | |||
/// An allocation of the given capacity that needs to be deallocated using arrows's cache aligned allocator. | |||
/// See [allocate_aligned] and [free_aligned]. | |||
Arrow(usize), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventually I could see us removing this in favor of Global, but I kept it for now
/// An allocation from an external source like the FFI interface or a Rust Vec. | ||
/// Deallocation will happen | ||
/// An allocation using the system's default global allocator and the provided layout | ||
Global(Layout), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does increase the size of Dellocation
by 8 bytes. In practice this is extremely unlikely to matter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how this is going to be used. But the addition looks reasonable by itself.
I need to think a bit more on this, the challenge is Vec will call dealloc with the alignment it would ask for, not the alignment that is actually correct 🤔 |
I plan to handle this differently |
Which issue does this PR close?
Part of #3516
Rationale for this change
This is the first part of supporting zero-copy conversion between
Vec
andMutableBuffer
. Crucially we need to carry along theLayout
as it is UB to call realloc or dealloc with a different layout from the one provided to the initial call toalloc
.What changes are included in this PR?
Are there any user-facing changes?