← Back to context

Comment by geofft

5 years ago

Yes, this is called "fallible allocations." You add methods with the "try_" prefix that work like the existing methods, except they return a Result which fails if it's out of memory instead of panicking.

We have a light / temporary fork of the Rust stdlib allocator with fallible allocation support: https://github.com/Rust-for-Linux/linux/tree/rust/rust/alloc

See e.g. https://github.com/Rust-for-Linux/linux/commit/487d7578bd036...