[zeromq-dev] prevent msg caching

Chuck Remes cremes.devlist at mac.com
Wed Sep 28 04:42:11 CEST 2011


On Sep 27, 2011, at 9:09 PM, Whit Armstrong wrote:

> I'm testing an R package for zmq.
> 
> I'm using push/pull and I would like to prevent messages from being
> cached at the receiver while I'm debugging the package.
> 
> I've tried the following:
> 
>    uint64_t hwm = 0;
>    zmq_setsockopt (receiver, ZMQ_HWM, &hwm, sizeof (hwm));
> 
>    uint64_t swap = 0;
>    zmq_setsockopt (receiver, ZMQ_SWAP, &swap, sizeof (swap));
> 
> However, as soon as I call zmq_connect on the pull socket (the
> receiver), the push socket sends 100s of messages before I even make
> the first call to zmq_recv.  If I let the app run without calling
> zmq_recv at all on the pull socket I can see the memory slowly build
> on the receiver process.
> 
> So, my question is what other zmq options (or kernel options) do I
> need to set to prevent the sender from sending (and prevent the
> receiver from caching) while I debug the app?

The default value of 0 means "no limit."

http://api.zeromq.org/2-1:zmq-setsockopt

Try setting it to 1.

cr




More information about the zeromq-dev mailing list