[zeromq-dev] [2.1.0] Problems with lruqueue from The Guide (tm)
Ivan Pechorin
ivan.pechorin at gmail.com
Wed Dec 8 16:05:55 CET 2010
2010/12/8 Steven McCoy <steven.mccoy at miru.hk>:
> the client hangs in zmq_term unless you modify the code to close each 0MQ socket before closing the thread
By the way, closing a thread that created a 0MQ socket is not a good
idea due to memory leaks.
On Linux, each thread leaks 54 bytes of memory on close.
0MQ 2.0.10, RHEL4u8, gcc 3.4.6, 32-bit build,
/lib/tls/libuuid.so.1.2 comes from e2fsprogs 1.35 (shipped with RHEL4)
Here is an output from Valgrind:
54 bytes in 1 blocks are possibly lost in loss record 581 of 1,126
at 0x4006374: memalign (vg_replace_malloc.c:581)
by 0x163188: ___tls_get_addr (in /lib/ld-2.3.4.so)
by 0x6668340: ??? (in /lib/tls/libuuid.so.1.2)
by 0x6668F55: uuid__generate_random (in /lib/tls/libuuid.so.1.2)
by 0x6668FD8: uuid_generate_random (in /lib/tls/libuuid.so.1.2)
by 0x6669005: uuid_generate (in /lib/tls/libuuid.so.1.2)
by 0x659DD58: zmq::uuid_t::uuid_t() (uuid.cpp:86)
by 0x659B066: zmq::socket_base_t::attach_pipes(zmq::reader_t*,
zmq::writer_t*, std::basic_string<unsigned char,
std::char_traits<unsigned char>, std::allocator<unsigned char> >
const&) (socket_base.cpp:639)
by 0x6598D75: zmq::socket_base_t::connect(char const*) (new_allocator.h:69)
by 0x65A08FB: zmq_connect (zmq.cpp:348)
by 0x6544256: zmq::socket_t::connect(char const*) (zmq.hpp:239)
On Windows, the leak was even worse, but I couldn't trace its source
(no Valgrind for Windows unfortunately).
Environment: Visual Studio 2010, 32-bit build, Windows 7 and Windows
2003 Server.
Proper thread pool that doesn't ever close threads fixed the problem
for us both on Linux and Windows.
Regards,
Ivan
More information about the zeromq-dev
mailing list