[zeromq-dev] memory leak or heap problem in czmq on Windows build

Ivan Pechorin ivan.pechorin at gmail.com
Wed Apr 2 08:26:24 CEST 2014


2014-04-02 19:10 GMT+13:00 Pritesh Acharya <priteshacharya at gmail.com>:

> Hi,
> zmq version: zeromq-4.0.3(build as Windows DLL)
> czmq version: czmq-2.0.3(build as Windows DLL)
> IDE: Visual Studio Professional 2010
>
> I have a small progream which creates two thread and uses ZMQ_PAIR socket
> over inproc to send data from one to another.
> One thread sends data using zstr_send and other receives using zstr_recv.
> If I don't free string received from zstr_recv , I get constant increase
> of memory (via Task Manager).
> If I free it using free(), i get heap corruption error on the frist free.
>
>
You should use zstr_free() instead of free() to free the string returned
from zstr_recv().
It's documented in current czmq trunk, not sure why it is missing from
http://czmq.zeromq.org/manual:zstr

//  Free a provided string, and nullify the parent pointer. Safe to call on
//  a null pointer.
CZMQ_EXPORT void
    zstr_free (char **string_p);


Kind regards,
Ivan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140402/0a790c10/attachment.htm>


More information about the zeromq-dev mailing list