AllocRef should have an owns method for determining if a particular allocation came from specific allocation. Obviously, many allocators couldn't know for sure, so it would have to be best effort.
fn owns(&self, ptr: NonNull<u8>, layout: Layout) -> bool;
or
pub enum Owns {
Yes,
Maybe,
}
fn owns(&self, ptr: NonNull<u8>, layout: Layout) -> Owns;
This could be very useful for implementing combinatorial allocators, like in https://www.youtube.com/watch?v=LIb3L4vKZ7U.
AllocRefshould have anownsmethod for determining if a particular allocation came from specific allocation. Obviously, many allocators couldn't know for sure, so it would have to be best effort.or
This could be very useful for implementing combinatorial allocators, like in https://www.youtube.com/watch?v=LIb3L4vKZ7U.