Skip to content

Provide alignment-changing realloc on GlobalAlloc #102

Open
@CAD97

Description

@CAD97

This is a short-term potentially stabilizable incremental improvement on the status quo.

Zulip discussion

There's at least two benefits to doing this:

This would probably take the shape of unsafe fn grow(&self, ptr: *mut u8, old_layout: Layout, new_layout: Layout) -> *mut u8 { ... } and shrink for GlobalAlloc along with the plumbing to see that through. These should probably be defaulted to call realloc where possible to avoid pessimization of old GlobalAlloc implementers.

Alternatively to providing the grow/shrink split on GlobalAlloc, some alternative symbol to realloc could be used which still allows both grow and shrink. C-inspired bad idea: realloc_s 😛 but resize might be fine. realloc will still exist (maybe deprecated) to point at resize as the improved alternative.

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