Skip to content

Semantics on allocating and deallocating with different Allocator #133

Open
@Ddystopia

Description

@Ddystopia

I propose to explicitly allow to allocate and deallocate with different implementations of Allocator trait under specified circumstances. I'm not sure how exactly it must be done, but I guess it would not increase complexity of Allocator trait while provide some benefits:

  • It can help Vec too, because on resize Vec is passing old pointer, so allocator might not need to store pointers to original data storage, reducing size of Vec<T, A>.
  • Resolve Split Allocator trait #112, because bumpalo can just allocate in Box<T, Bump> and then convert to Box<T, Noop>.
  • Kind of allow &move T, because it's semantics are quite similar to Box<T, Noop>.
  • Increase flexibility.

Maybe conversion can be allowed only via impl From<Box<T, A1>> for Box<T, A2> where A1: From<A2>, or just allow (declare sound) to Box::from_raw_in(Box::into_raw(box)).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions