Skip to content
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

Provide alignment-changing realloc on GlobalAlloc #102

Open
CAD97 opened this issue Jul 1, 2022 · 0 comments
Open

Provide alignment-changing realloc on GlobalAlloc #102

CAD97 opened this issue Jul 1, 2022 · 0 comments

Comments

@CAD97
Copy link

CAD97 commented Jul 1, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant