[zeromq-dev] OUT OF MEMORY on Win using inproc transport

Chuck Remes cremes.devlist at mac.com
Wed Jan 18 20:31:42 CET 2012

On Jan 18, 2012, at 12:41 PM, Serg Gulko wrote:

> Dear All! 
> I facing some strange behaviour of zmq(version 2.1.11, complied using MSVC 2010, Windows 7 Home). Here is code example: http://pastebin.com/BJ5H8rct
> I setup PUB socket, set minimal HWM on it, started thread with SUB(subscribed on all messages) and start pushing data into PUB socket. 
> After about 8 seconds(on my machine) I got OUT OF MEMORY error in src/yqueue.hpp at line 109.
> Then I decided to put some delays for PUB process between pushing messages and error is gone. 
> Strange thing is that HWM set on PUB socket to keep only one message so I was expecting to loose all slow comers but definitely not get OUT OF MEMORY.
> Any ideas what is this and how to avoid such problems?

Line 28 of your example code is wrong. It is not correctly setting a high water mark. It is probably reading garbage because you are getting the string length of the MESSAGE constant and using that as the option length.

  zmq_setsockopt(intDataSocket, ZMQ_HWM, &messagesToStore, strlen(MESSAGE));

Fix that and try again.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20120118/c95c9a29/attachment.htm>

More information about the zeromq-dev mailing list