Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> A bunch of us, anticipating a reaction like Linus' have been arguing that we need `try_` versions of everything and* a way to prevent the other ones from being used.

This has been anticipated since panic on OOM was introduced.

Adding `try_` version of everything is a horrible solution.

What you want is for the normal APIs to return Result<R,E> where E=! when panic on OOM and some OOM error otherwise.

The largest irony of all time is that, while returning an error on OOM works well on Windows, it makes little sense on Linux because overcommit is often enable by default. Linux and Linux users are directly responsible for the "panic on OOM" that turns out now prevents liballoc from being used in the Linux kernel.

The obvious fix here is for the kernel to use overcommit internally \s



> What you want is for the normal APIs to return Result<R,E> where E=! when panic on OOM and some OOM error otherwise.

That's a fun idea! I haven't seen that proposed before, but it would work well once we have the ability to configure std and alloc.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: