[zeromq-dev] Memory management?

Nishant Mittal nmittal at rblt.com
Wed Apr 10 21:54:03 CEST 2013


Jon, so i do have to do "delete message" when done? wow.. that would
explain all the memory leaks I have been pulling my hair over!

thanks
Nishant


On Wed, Apr 10, 2013 at 3:12 PM, Jon Dyte <jon at totient.co.uk> wrote:

> Nishant,
> zmq_msg_close tells 0MQ to free it up though not necessarily at the point
> zmq_msg_close is called.
>
> in the snippet below you'll have to call delete afterwards on 'message' if
> you no longer need it.
>
> Also 'data' isnt safe to use after zmq_msg_close is called.
>
> Jon
>
> On 10 April 2013 18:31, Nishant Mittal <nmittal at rblt.com> wrote:
>
>> when i do..
>>
>> *zmq_msg_t *message = new zmq_msg_t();*
>> *zmq_msg_init (message);*
>> *int size = zmq_msg_recv (message, skt, 0);*
>> *
>> *
>> *char *data = (char *) zmq_msg_data (message);
>> *
>> *
>> *
>> *zmq_msg_close (message);
>> *
>>
>> do I have to free memory pointed by "data" or the zmq_msg_close will
>> clean it up?
>>
>> thanks
>> Nishant
>>
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>
>>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>


-- 
*Nishant Mittal*
Director, Product Development
*Rosenblatt Securities Inc*.
20 Broad Street
New York, NY 10005

Direct: 212-607-3159
Mobile: 646-504-2629
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130410/581c3323/attachment.htm>


More information about the zeromq-dev mailing list