Skip to content

Add best-effort owns method? #52

@lachlansneff

Description

@lachlansneff

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions