I am using ZeroMQ in C# language. It is throwing following error:
OutOfMemoryException: zmq_msg_init_size
Below is the code snippet:
private void onDataArrived(object sender, DataArrivedEventArgs e)
{
// receive the data in the form of bytearray
var message = new ZMessage{ new ZFrame(bytearray) };
publisher.Send(message);
}
The onDataArrived
is a callback function. The publisher is defined in class constructor as follows:
zmqContext = new ZContext();
publisher = new ZSocket(zmqContext, ZSocketType.PUB);
publisher.Bind("tcp://*:9001"); // Using depth data port
Any suggestions?
Do I need to destroy the message
?
Please note that I just want to send the bytearray
. Since I don't know the best way, I created ZFrame
and ZMessage
objects.
Inside the Visual Studio Debugger, I noticed that Process Memory is keep on increasing and going up to 4 GB
. The error is being thrown at this moment.