[zeromq-dev] Pub/Sub with crashing subscribers - possible memory leak?

Christian Kamm kamm at incasoftware.de
Tue Jul 2 10:55:50 CEST 2013

On 07/01/2013 08:40 PM, Samuel Lucas Vaz de Mello wrote:
> I have a simple PUB server that bind to an address and several SUB
> clients that connect to it. It seems that memory is leaking at server as
> clients connect/disconnect.

With your test setup, I can make the memory leak go away by adding a
zmq_poll() next to the sleep in pub.c.

The background is that pipe termination works by sending commands
between the io threads and the publisher socket. If the main thread just
sleeps, the pub socket will never process these commands. Calling
zmq_poll() triggers command processing. Many other calls - like sending
messages - would do so as well and one usually doesn't have to worry
about it.

The message topic mentions crashing subscribers. Maybe you need to make
them crash to reproduce the issue?


More information about the zeromq-dev mailing list