[zeromq-dev] ZMQ allocating all available memory when sending

Pieter Hintjens ph at imatix.com
Fri Nov 18 15:14:49 CET 2011

On Fri, Nov 18, 2011 at 3:59 AM, Clemens Lutz <lutzc at student.ethz.ch> wrote:

> I've been writing a benchmark to verify ZeroMQ's performance is near line-rate
> on the machines I'm using. However, I keep running into the issue of ZMQ
> allocating memory on the sender's side equal to the amount I'm sending. If I
> want to send more data than I have physical memory the program will exit with
> an "out of memory" error.

zmq_send is asynchronous, so does not send right away but queues the
message in memory. Actual sending is limited by the network capacity.
So messages will build up. Setting ZMQ_HWM on the sender socket should
limit the number of messages. If you have a test case where setting
ZMQ_HWM doesn't work, please post it.


More information about the zeromq-dev mailing list