I am using protobuf for communication between clients and servers. When I use valgrind to check the client binary, the following messages are listed. It seems there is some possible lost memory in __static_initialization_and_destruction_0. But why does this appear? How to suppress it?
==2928== 43 bytes in 1 blocks are possibly lost in loss record 549 of 711 ==2928== at 0x4C2B1C7: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==2928== by 0x5A0EA88: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16) ==2928== by 0x5A0F7FA: std::string::_Rep::_M_clone(std::allocator<char> const&, unsigned long) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16) ==2928== by 0x5A0FF5B: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16) ==2928== by 0x529E800: google::protobuf::SimpleDescriptorDatabase::DescriptorIndex<std::pair<void const*, int> >::AddFile(google::protobuf::FileDescriptorProto const&, std::pair<void const*, int>) (in /usr/lib/libprotobuf.so.7.0.0) ==2928== by 0x529A677: google::protobuf::EncodedDescriptorDatabase::Add(void const*, int) (in /usr/lib/libprotobuf.so.7.0.0) ==2928== by 0x52677A6: google::protobuf::DescriptorPool::InternalAddGeneratedFile(void const*, int) (in /usr/lib/libprotobuf.so.7.0.0) ==2928== by 0x427CB0: com::ots::protobuf_AddDesc_ots_5fprotocol_2eproto() (ots_protocol.pb.cc:1075) ==2928== by 0x4507FE: com::ots::StaticDescriptorInitializer_ots_5fprotocol_2eproto::StaticDescriptorInitializer_ots_5fprotocol_2eproto() (ots_protocol.pb.cc:1162) ==2928== by 0x44D43D: __static_initialization_and_destruction_0(int, int) (ots_protocol.pb.cc:1164) ==2928== by 0x44D452: _GLOBAL__sub_I__ZN3com3ots42protobuf_AssignDesc_ots_5fprotocol_2eprotoEv (ots_protocol.pb.cc:11800) ==2928== by 0x45C66C: __libc_csu_init (in /home/ots/unittest/test_ots_client) In normal cases, the client runs very well. However, when I increase threads to 50, the program receives SIGABRT in __do_global_dtors_aux. The backtrace is listed below. #0 0x000000354ea30265 in raise () from /lib64/libc.so.6 #1 0x000000354ea31d10 in abort () from /lib64/libc.so.6 #2 0x000000354ea6a84b in __libc_message () from /lib64/libc.so.6 #3 0x000000354ea72856 in free () from /lib64/libc.so.6 #4 0x0000000001e433cf in clear (this=0x32a7760) at /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ext/new_allocator.h:94 #5 0x0000000001e46668 in ~FileDescriptorTables (this=0x32a76c0) at /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ext/hashtable.h:361 #6 0x000000354ea3368e in __cxa_finalize () from /lib64/libc.so.6 #7 0x00002b47191796a6 in __do_global_dtors_aux () from /home/ots/build/debug64/lib/libprotobuf.so.7 #8 0x0000000000000000 in ?? () The message from valgrind and the SIGABRT error indicate that the root cause is the Descriptor. But the initialization and destruction of Descriptors are done by libprotobuf.so automatically, and I modify nothing about them. Anyone has any idea? -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/groups/opt_out.