[zeromq-dev] Problem with durapub2 example

Tonis Xie tonis.xie at gmail.com
Thu Jul 28 02:33:02 CEST 2011

After the bind() call, as below:

    //  Subscriber tells us when it's ready here
    void *sync = zmq_socket (context, ZMQ_PULL);
    zmq_bind (sync, "tcp://*:5564");

    //  We send updates via this socket
    void *publisher = zmq_socket (context, ZMQ_PUB);
    zmq_bind (publisher, "tcp://*:5565");

    //  Prevent publisher overflow from slow subscribers
    uint64_t hwm = 5;
    zmq_setsockopt (publisher, ZMQ_HWM, &hwm, sizeof (hwm));

    //  Specify swap space in bytes, this covers all subscribers
    //uint64_t swap = 25000000;
    //zmq_setsockopt (publisher, ZMQ_SWAP, &swap, sizeof (swap));

    //  Wait for synchronization request
    char *string = s_recv (sync);
    free (string);

On Wed, Jul 27, 2011 at 7:12 PM, Ian Barber <ian.barber at gmail.com> wrote:

> On Wed, Jul 27, 2011 at 12:03 PM, Tonis Xie <tonis.xie at gmail.com> wrote:
>> I changed the "sleep(1)" in durapub2.c to "usleep(10)", make the loop run
>> infinitely, start durapub2 and durasub, ctrl-c durasub, and I am seeing that
>> the allocated memory of durapub2 keep raising just like never hitting a
>> limit at all! However, I set the HWM to only 5.
> Just to check with the changes, is the call to setsockopt with the HWM made
> before the bind() call, or after?
> Ian
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110728/ddf658a5/attachment.htm>

More information about the zeromq-dev mailing list