3 ms·
> The Haskell runtime keeps track of how much memory each Haskell thread has allocated in total, and if that total exceeds the limit we set, the thread receives
by runeks 10y ago
> The Haskell runtime keeps track of how much memory each Haskell thread has allocated in total, and if that total exceeds the limit we set, the thread receives an asynchronous exception, namely AllocationLimitExceeded. The user code running on our platform is not permitted to catch this exception, instead the server catches it, logs some data to aid debugging, and sends an error back to the client that initiated the request.
This is actually pretty cool. This way the server stays in charge of the threads it spawns, rather than having to build in some auto-destruct feature into the thread itself (which may not necessarily fire). The thread becomes more like a sandboxed environment -- with resource quotas -- than an independent entity, which I think is what we want, if we want to be able to reason about our code.