Skip to content

Feature request: Allocating large values on the heap (new_uninit) #879

Description

@hoshinolina

The kernel has very small stacks, and Box::try_new(T {}) does not reliably avoid putting T {} on the stack. It seems the only reasonable way to guarantee that T does not make a trip through the stack is to use unsafe code, with Box::try_new_zeroed() or similar. This requires the new_uninit feature.

I'd love to hear any better ideas of how to handle this... try_new_zeroed only really works safely for types where the zero bit pattern is valid, which doesn't cover all cases that Box::try_new(T {}); does.

Metadata

Metadata

Assignees

No one assigned

    Labels

    • libRelated to the `rust/` library.

    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