Be sure to call ShutdownProtobufLibrary() to clean up all descriptors and such on exit:
http://code.google.com/apis/protocolbuffers/docs/reference/cpp/google.protobuf.common.html#ShutdownProtobufLibrary.details On Wed, Mar 31, 2010 at 3:05 PM, Evan Jones <ev...@mit.edu> wrote: > When I use valgrind on my programs that use protocol buffers, I get many > "possibly lost" warnings from valgrind. They all appear to be caused by > descriptor pools. I've looked at the code briefly, and I don't really > understand why these warnings happen, but I haven't tried too hard to figure > them out. > > Is there any hack I could apply in order to suppress these warnings, either > in my code or in my copy of the protobuf library? Thanks, > > Evan > > Sample warning: > > > ==17815== 2,004 bytes in 47 blocks are possibly lost in loss record 62 of > 62 > ==17815== at 0x402573E: operator new(unsigned) (vg_replace_malloc.c:224) > ==17815== by 0x40D7993: std::string::_Rep::_S_create(unsigned, unsigned, > std::allocator<char> const&) (in /usr/lib/libstdc++.so.6.0.10) > ==17815== by 0x40D8407: std::string::_Rep::_M_clone(std::allocator<char> > const&, unsigned) (in /usr/lib/libstdc++.so.6.0.10) > ==17815== by 0x40D91EE: std::string::string(std::string const&) (in > /usr/lib/libstdc++.so.6.0.10) > ==17815== by 0x809F339: > google::protobuf::SimpleDescriptorDatabase::DescriptorIndex<std::pair<void > const*, int> >::AddFile(google::protobuf::FileDescriptorProto const&, > std::pair<void const*, int>) (stl_pair.h:89) > ==17815== by 0x809BC73: > google::protobuf::EncodedDescriptorDatabase::Add(void const*, int) > (descriptor_database.cc:312) > ==17815== by 0x806A6AF: > google::protobuf::DescriptorPool::InternalAddGeneratedFile(void const*, int) > (descriptor.cc:860) > ==17815== by 0x808781E: > google::protobuf::protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto() > (descriptor.pb.cc:599) > ==17815== by 0x8087B5A: > _GLOBAL__I__ZN6google8protobuf58protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eprotoEv > (descriptor.pb.cc:644) > ==17815== by 0x80C3C6C: (within > /home/evanj/hstore/hstore-async/build/protorpc/protorpcchannel_test) > ==17815== by 0x804A8EF: (within > /home/evanj/hstore/hstore-async/build/protorpc/protorpcchannel_test) > ==17815== by 0x80C3C08: __libc_csu_init (in > /home/evanj/hstore/hstore-async/build/protorpc/protorpcchannel_test) > > > > -- > Evan Jones > http://evanjones.ca/ > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To post to this group, send email to proto...@googlegroups.com. > To unsubscribe from this group, send email to > protobuf+unsubscr...@googlegroups.com<protobuf%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/protobuf?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.