Skip to content

Feature request: OOM handling #996

Open

Description

@khanhtranngoccva

I am currently writing a filesystem application that runs on end-user devices and I would like to take advantage of io_uring. This often means that memory usage is very unpredictable and OOM conditions may happen often. In this case, I do not want to leave my filesystem in an inconsistent state because some computation (e.g. IO submissions, task spawning, and so on) panics.

Is it possible to have the compio library return errors when an out-of-memory condition happens?

Activity

  1. added theissue type on Aug 4, 2026
  2. Berrysoft commented on Aug 10, 2026

    @Berrysoft
    Member

    In short I don't think it's easy, as allocator_api is still a nightly feature...

  3. khanhtranngoccva commented on Aug 18, 2026

    @khanhtranngoccva
    Author

    @Berrysoft I have been making a prototype polyfill that deals with making std data structures OOM-friendly, as well as implementing ponyfills of custom data structures like slot maps and concurrent hash maps. My current approach (stored in the experimental branch) is to take advantage of the compiler's deterministic layout generation algorithm and regenerate mirrored structs that are source-compatible and thus ABI-compatible inside a FFI boundary (this requires suppressing -Zrandomize-layout. There are certain Rust structures that lose data integrity on OOM like BTrees and ponyfills risk API breaking changes, so I have to resort to it).

    I want to ask you to help with reviewing the approach. It is currently not yet polished for now though as I have been prototyping it using a LLM, and I'm gradually reviewing and refining the output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions