No, the C++ wrapper calls the ZMQ functions directly, no heap allocation involved. The Event handle's that are leaking are make_fdpair's fault.
As you said you runned your C code with valgrind I assume that you have runned it in a Linux. The leak only reproduces on Windows, as the leaky piece of code is inside a Windows-only section. Seems that someone noted the leak too (http://lists.zeromq.org/pipermail/zeromq-dev/2012-December/019784.html). Em 22/12/2012 09:14, Pieter Hintjens escreveu: > When I run the same code in C, with valgrind, I don't see any memory > leaks. Does the C++ runtime not use the heap? > > #include <czmq.h> > > int main (void) > { > zctx_t *ctx = zctx_new (); > int i; > for (i = 0; i < 1000; ++i) { > void *front = zsocket_new (ctx, ZMQ_PAIR); > void *back = zsocket_new (ctx, ZMQ_PAIR); > zsocket_bind (front, "inproc://test%d", i); > zsocket_connect (back, "inproc://test%d", i); > } > zctx_destroy (&ctx); > return 0; > } > > -Pieter > > On Thu, Dec 20, 2012 at 1:50 PM, Felipe Farinon > <[email protected]> wrote: >> I'm using version 3.2.2 of ZeroMQ, running on a Windows 7, compiled with >> a MSVC 10. >> >> The following piece of code reproduces the problem: >> http://pastebin.com/6p2sLaEM >> >> It seems that if we create lots of PAIR sockets in Windows, we get an >> event leak. The event leak is shown by this image, taken at the end of >> the loop execution: >> https://dl.dropbox.com/u/2612634/leak.png >> >> The error is in signaler.cpp method zmq::signaler_t::make_fdpair, which >> creates the events but never releases them. >> _______________________________________________ >> 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 > _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
