> > 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.
Thanks, this solved the issue for me too. In my scenario this socket is not frequently used (most of the messages use another zmq sockets), so I think it's worth to include the pub socket in my zmq_poll as well. > The message topic mentions crashing subscribers. Maybe you need to make > them crash to reproduce the issue? Not really, sorry for the title. When I started investigating I suspected that this was caused by subscribers that didn't close the socket/context before leaving, but while looking for the minimal test case to report I realized that it happened even with sockets properly closed - then I forgot to update the title. Thank you, - Samuel
_______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
