[zeromq-dev] zeromq Windows handle leak?

KIU Shueng Chuan nixchuan at gmail.com
Tue Dec 25 16:44:03 CET 2012


Eh? Doesn't the pirate pattern do a close and open?

I was referring to a win32 HANDLE leak. I seem to have located the leak.
zmq::signaler_t::make_fdpair() opens an Event but fails to CloseHandle it.
Adding the CloseHandle, the handle count for the sample program stays
constant in task manager.
On Dec 25, 2012 11:20 PM, "Pieter Hintjens" <ph at imatix.com> wrote:

> Opening and closing sockets repeatedly is a very bad idea. Since
> sockets are in fact closed asynchronously and only finally when you
> call zmq_ctx_destroy, this code will indeed leak memory.
>
> -Pieter
>
> On Tue, Dec 25, 2012 at 10:55 AM, KIU Shueng Chuan <nixchuan at gmail.com>
> wrote:
> > The following snippet seems to be leaking 1 handle per second, as viewed
> > from task manager.
> >
> > OS: Windows XP SP3 32-bits
> > Library: ZeroMQ v3.2.2
> >
> > -----------------------------
> > #include <zmq.h>
> > #include <zmq_utils.h>
> >
> > int main()
> > {
> > void *ctx = zmq_ctx_new();
> > while (1) {
> > void *zsock = zmq_socket(ctx, ZMQ_DEALER);
> > zmq_close(zsock);
> > zmq_sleep(1);
> > }
> > zmq_ctx_destroy(ctx);
> > return 0;
> > }
> >
> >
> > _______________________________________________
> > 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20121225/02205030/attachment.htm>


More information about the zeromq-dev mailing list