[zeromq-dev] memory leak in PUB/SUB sockets

Daniel Sentenac sentenac at ego-gw.it
Thu Oct 7 12:05:03 CEST 2010


Hi,

I have been digging in the code to understand the mechanism of 
allocation/deallocation of the messages in PUB/SUB mode, and I have 
found a the way to cure the memory leak.
In pub.cpp:
 //  Push the message to all destinations.
    for (pipes_t::size_type i = 0; i != active;) {
      if (!write (pipes [i], msg_) ) {
    zmq_msg_close(msg_); // content->refcnt.sub(1);
      }
      else
    i++;
    }

Cheers,
Daniel




More information about the zeromq-dev mailing list