-
Notifications
You must be signed in to change notification settings - Fork 9
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
Box in Arena Allocator is !Send #114
Comments
This could also just be solved in your own code by passing |
But I need |
Perhaps this could be implemented as functionality in the arena allocator: impl Arena {
// DummyAlloc is ZST and only allows dealloc, panics on alloc.
fn with_dummy_alloc<T>(b: Box<T, &'_ Arena>) -> Box<T, DummyAlloc>;
} As I've mentioned in #112, I think that splitting the |
I agree that splitting allocator trait may be too much complicated over benefits it gives :( But mapping box allocator is a bit a leaking abstraction. |
One more optional trait that has only one method of |
Hey!
Recently I started migrating from
bumpalo
toallocator-api
and encountered an issue.bumpalo::boxed::Box
isSend
, butstd::boxed::Box
isSend
ifA: Send
, and in the case of arena allocatorsA
is&ArenaAlloc
, so it requiresArenaAlloc: Sync
, which is not the case for most of them.So that, when you don't need to clone/realloc the box, and dealloc is a no-op (for arena allocators), there is no need to store the allocator inside
Box
.There is already the issue #112 for splitting
Allocator
trait, to reduceBox
overhead by using ZST deallocator type when you need it. This can also solve the requirement for the arenaAllocator
to beSync
, in favor of storing()
deallocator.So I am bringing another useful use case to this discussion.
The text was updated successfully, but these errors were encountered: