Skip to content

Scoped allocators and unwinding on OOM #62

Closed
@Ekleog

Description

@Ekleog

Hello,

A thought I just had: assume a rust server running multiple things on behalf of clients. It uses regular Rust code, that is not written to care specifically about this particular use case.

The server wants to limit the memory consumption clients could force upon it. It does so by having each client's allocations be in an arena allocator, and then wants to abort just that client's connection in case of OOM.

Unfortunately, this means that OOM must not abort the whole process, and that appears to be what the current behavior is, even with set_alloc_error_hook -- or at least so do the docs read like.

What would you think about making it possible for the alloc error hook to change the global allocator and then be allowed to unwind the stack? Or maybe it's already possible, and the docs that state that this function is invoked before the runtime aborts is just missing a part saying that it's actually possible, and that if this function doesn't return () then the runtime won't abort?

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