Great, that solved it! Works as expected now.

May I suggest you add that line to the online documentation? Also, I 
previously didn't find the zmq manual pages as I was looking for "man zmq.h" 
and "man zmq.hpp" which seems to be the naming convention for library manual 
pages.

Thanks,
Clemens

On Saturday 19 November 2011 11.56:16 Pieter Hintjens wrote:
> Clemens,
> 
> Set the HWM before doing the connect. Note this line from the
> zmq_setsockopt man page:
> 
> "Caution: All options, with the exception of ZMQ_SUBSCRIBE,
> ZMQ_UNSUBSCRIBE and ZMQ_LINGER, only take effect for subsequent socket
> bind/connects."
> 
> -Pieter
> 
> On Sat, Nov 19, 2011 at 10:45 AM, Clemens Lutz <[email protected]> 
wrote:
> > Hi Pieter,
> > 
> > Thanks for the response. Attached is a test case where setting ZMQ_HWM
> > doesn't work. Setting ZMQ_HWM to 1024 with 1 KiB messages should limit
> > the queue's size to ~1 MiB, right? "top" still reports around one GiB
> > of memory usage when sending that amout of data.
> > This is with ZMQ v.2.1.10.
> > 
> > Cheers,
> > Clemens
> > 
> > On Friday 18 November 2011 08.14:49 Pieter Hintjens wrote:
> >> On Fri, Nov 18, 2011 at 3:59 AM, Clemens Lutz <[email protected]> 
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.
> >> 
> >> -Pieter
> >> _______________________________________________
> >> zeromq-dev mailing list
> >> [email protected]
> >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> > 
> > _______________________________________________
> > zeromq-dev mailing list
> > [email protected]
> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> 
> _______________________________________________
> zeromq-dev mailing list
> [email protected]
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to