# Should out-of-memory ever be caught in libraries/framework?

**URL:** <https://discuss.ocaml.org/t/should-out-of-memory-ever-be-caught-in-libraries-framework/10712>\
**Category:** Ecosystem\
**Tags:** exceptions\
**Created:** [October 27, 2022, 8:21am UTC](https://discuss.ocaml.org/t/should-out-of-memory-ever-be-caught-in-libraries-framework/10712 "2022-10-27T08:21:14Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Chet\_Murthy](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/chet_murthy/32/1501_2.png) [@Chet\_Murthy](https://discuss.ocaml.org/u/Chet_Murthy)\
**Post date:** [October 27, 2022, 5:21pm UTC](https://discuss.ocaml.org/t/should-out-of-memory-ever-be-caught-in-libraries-framework/10712/4 "2022-10-27T17:21:44Z")

</div>

If the goal is to build fault-tolerant systems, then one should never catch an exception that one cannot deal with _completely_. And since OOM is almost by definition impossible to deal with completely, one should not catch it. Unless, of course, one is going to suicide the process.

This is a specific instance of the general rule about building fault-tolerant systems: when a fault occurs, it should be allowed to propagate upward/outward to the boundary of the region of the system that can conclusively and fully deal with the fault, repairing it completely.

Rick Harper’s notes on fault-tolerance explain in detail: [https://www.fastonline.it/sites/default/files/2019-06/RobustProgramming.pdf](https://www.fastonline.it/sites/default/files/2019-06/RobustProgramming.pdf)

---

_[View the full topic](https://discuss.ocaml.org/t/should-out-of-memory-ever-be-caught-in-libraries-framework/10712)._
