Hi Nishant, yes.
alternatively if you don't need the zmq_msg_t on the heap just put it on the stack zmq_msg_t msg; and use &msg instead of message in yr code below. jon On 10 April 2013 20:54, Nishant Mittal <[email protected]> wrote: > 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 <[email protected]> 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 <[email protected]> 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 >>> [email protected] >>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev >>> >>> >> >> _______________________________________________ >> zeromq-dev mailing list >> [email protected] >> 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 > > _______________________________________________ > zeromq-dev mailing list > [email protected] > http://lists.zeromq.org/mailman/listinfo/zeromq-dev > >
_______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
