Re: [asio-users] valgrind reports memory error
Brought to you by:
chris_kohlhoff
|
From: Christopher K. <ch...@ko...> - 2007-07-09 07:43:02
|
On Wed, 27 Jun 2007 14:12:02 +0800, "Cheng Lian" <rhy...@gm...> said: > Hi, all > > I'm checking memory leaks in my program. And these lines: > > tcp::resolver resolver( ios ); > tcp::resolver::query query( host, port ); > tcp::resolver::iterator endpoint_iterator = resolver.resolve( query ); > > causes the following "valgrind -q" output: > > ==28986== Syscall param socketcall.sendto(msg) points to uninitialised > byte(s) > ==28986== at 0x5295275: sendto (in /lib/libc-2.3.6.so) > ==28986== by 0x52B3899: (within /lib/libc-2.3.6.so) > ==28986== by 0x527FF2C: getaddrinfo (in /lib/libc-2.3.6.so) > ==28986== by 0x42391B: > boost::asio::detail::socket_ops::getaddrinfo(char const*, char const*, > addrinfo const*, addrinfo**, boost::system::error_code&) > (socket_ops.hpp:1553) > ==28986== by 0x423A70: > boost::asio::detail::resolver_service<boost::asio::ip::tcp>::resolve(boost::shared_ptr<void>&, > boost::asio::ip::basic_resolver_query<boost::asio::ip::tcp> const&, > boost::system::error_code&) (resolver_service.hpp:146) > ==28986== by 0x423B90: > boost::asio::ip::resolver_service<boost::asio::ip::tcp>::resolve(boost::shared_ptr<void>&, > boost::asio::ip::basic_resolver_query<boost::asio::ip::tcp> const&, > boost::system::error_code&) (resolver_service.hpp:105) > ==28986== by 0x423BDC: > boost::asio::ip::basic_resolver<boost::asio::ip::tcp, > boost::asio::ip::resolver_service<boost::asio::ip::tcp> > >::resolve(boost::asio::ip::basic_resolver_query<boost::asio::ip::tcp> > const&) (basic_resolver.hpp:98) > ==28986== by 0x4058B8: main (echo_client.cpp:39) > ==28986== Address 0x7FEFFFD11 is on thread 1's stack > > Seems that some memory range is not initialized? I'm sorry that I've got > no time to track this down, since it's not really so important and > doesn't affect my program functionalities. Yes, I have seen this before. I believe it's a "problem" in the linux getaddrinfo implementation, not asio code. You can see in the stack that it refers to a sendto() call inside getaddrinfo(). Cheers, Chris |