This is normal. In static builds your whole process has a single heap.
Using DLLs, there's a separate heap in the DLL.

On Wed, Apr 2, 2014 at 10:08 AM, Pritesh Acharya
<[email protected]> wrote:
> And the strange thing is, If I use static version of czmq build, everything
> works fine and no error on free(string).
>
>
> On Wed, Apr 2, 2014 at 11:55 AM, Pritesh Acharya <[email protected]>
> wrote:
>>
>> 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.
>>
>> Here is the code
>>
>> #include <iostream>
>> #include "czmq.h"
>> #include <boost/thread.hpp>
>>
>> zctx_t *zmq_ctx=NULL;
>>
>> void normalizer()
>> {
>>     void *xmitter;
>> xmitter = zsocket_new(zmq_ctx, ZMQ_PAIR);
>> zsocket_connect (xmitter, "inproc://sender");
>>     while(1)
>>     {
>> zstr_send (xmitter, "hello");
>> }
>> zsocket_destroy (zmq_ctx, xmitter);
>> }
>>
>> void sender()
>> {
>> void *receiver = zsocket_new(zmq_ctx, ZMQ_PAIR);
>>     int rc = zsocket_bind (receiver, "inproc://sender");
>> boost::thread t(&normalizer);
>> int counter=0;
>>     while(1)
>>     {
>> char *string = zstr_recv (receiver);
>> counter++;
>>         if(counter%10000==0)
>> {
>>             std::cout << "counter: " << counter << std::endl;
>> }
>> //free (string); //problem is here
>> }
>> zsocket_destroy(zmq_ctx, receiver);
>> }
>>
>> void main(void)
>> {
>> zmq_ctx = zctx_new();
>> boost::thread t(&sender);
>> t.join();
>> }
>>
>
>
> _______________________________________________
> 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

Reply via email to