[zeromq-dev] Handling OOM

Pieter Hintjens ph at imatix.com
Wed May 18 12:03:46 CEST 2011


On Wed, May 18, 2011 at 8:56 AM, Martin Sustrik <sustrik at 250bpm.com> wrote:

> There are two scenarios even on that side. Either user asked for
> allocating a bogus amount of memory, in which case returning ENOMEM is
> sufficient.
>
> Or, user asked for allocating reasonable-sized message, however,
> allocation failed because system is running low on memory. In this case
> emergency measures would be more appropriate.
>
> It's not clear how to distinguish the two though.

Like Paul suggested, the size of the requested allocation is a good
hint. Asking for a 4GB message is different than asking for a 50byte
one.

I'd suggest anything over 1M can fail without indicating OOM.

-Pieter



More information about the zeromq-dev mailing list