Possible memory leak on thread pool

RCF support and general discussion.
Post Reply
cinsk
Posts: 5
Joined: Mon Mar 18, 2013 6:24 am

Possible memory leak on thread pool

Post by cinsk »

On 64-bit Linux machine (the Linux has boost 1.49, though),
I just modified the demo server, Server.cpp, to increase the thread pool.
Then I ran Server and ran Client multiple times.

Code: Select all

int main()
{
    RCF::RcfInitDeinit rcfInit;

    // Start a TCP server on port 50001, and expose MyServiceImpl.
    MyServiceImpl myServiceImpl;
    RCF::RcfServer server( RCF::TcpEndpoint("0.0.0.0", 50001) );
    server.bind<MyService>(myServiceImpl);

    RCF::ThreadPoolPtr tpPtr(new RCF::ThreadPool(5));
    server.setThreadPool(tpPtr);
    server.start();

    std::cout << "Press Enter to exit..." << std::endl;
    std::cin.get();

    return 0;
}
Then, I ran Server with valgrind to check any possible memory leak,
and attached log file shows that in serveral points there are possible
leaks.

Could you investigate the log and tell me if it is a bug?

Or, did I miss something in using thread pool?

Attaching .txt or .log is not allowed, so I just paste here:

Code: Select all

==17615== Memcheck, a memory error detector
==17615== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==17615== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==17615== Command: ./Server
==17615== Parent PID: 10743
==17615== 
==17615== 
==17615== HEAP SUMMARY:
==17615==     in use at exit: 2,196 bytes in 50 blocks
==17615==   total heap usage: 144,507 allocs, 144,457 frees, 15,744,974 bytes allocated
==17615== 
==17615== 24 bytes in 1 blocks are definitely lost in loss record 1 of 11
==17615==    at 0x4C2AA57: operator new(unsigned long) (vg_replace_malloc.c:287)
==17615==    by 0x75FD83: RCF::ThreadLocalCached<std::vector<boost::function1<void, RCF::RcfSession&>, std::allocator<boost::function1<void, RCF::RcfSession&> > > >::ThreadLocalCached() (ThreadLocalData.hpp:129)
==17615==    by 0x6FAA33: RCF::RcfSession::onWriteCompleted() (RcfServer.cpp:614)
==17615==    by 0x6FA71D: RCF::RcfServer::onWriteCompleted(boost::shared_ptr<RCF::RcfSession>) (RcfServer.cpp:582)
==17615==    by 0x7235A1: RCF::AsioSessionState::onAppReadWriteCompleted(unsigned long) (AsioServerTransport.cpp:801)
==17615==    by 0x7210EA: RCF::AsioSessionState::onNetworkWriteCompleted(asio::error_code, unsigned long) (AsioServerTransport.cpp:486)
==17615==    by 0x71ED7C: RCF::WriteHandler::operator()(asio::error_code, unsigned long) (AsioServerTransport.cpp:112)
==17615==    by 0x7E8301: asio::detail::binder2<RCF::WriteHandler, asio::error_code, unsigned long>::operator()() (bind_handler.hpp:96)
==17615==    by 0x7E5742: void asio::asio_handler_invoke<asio::detail::binder2<RCF::WriteHandler, asio::error_code, unsigned long> >(asio::detail::binder2<RCF::WriteHandler, asio::error_code, unsigned long>, ...) (handler_invoke_hook.hpp:63)
==17615==    by 0x7E1493: void asio_handler_invoke_helpers::invoke<asio::detail::binder2<RCF::WriteHandler, asio::error_code, unsigned long>, RCF::WriteHandler>(asio::detail::binder2<RCF::WriteHandler, asio::error_code, unsigned long> const&, RCF::WriteHandler&) (handler_invoke_helpers.hpp:39)
==17615==    by 0x7D9001: asio::detail::reactive_socket_send_op<RCF::AsioBuffers, RCF::WriteHandler>::do_complete(asio::detail::task_io_service*, asio::detail::task_io_service_operation*, asio::error_code, unsigned long) (reactive_socket_send_op.hpp:102)
==17615==    by 0x7391A0: asio::detail::task_io_service_operation::complete(asio::detail::task_io_service&) (task_io_service_operation.hpp:34)
==17615==    by 0x73B1FD: asio::detail::task_io_service::do_one(asio::detail::scoped_lock<asio::detail::posix_mutex>&, asio::detail::task_io_service::idle_thread_info*) (task_io_service.ipp:277)
==17615==    by 0x73AC79: asio::detail::task_io_service::run_one(asio::error_code&) (task_io_service.ipp:151)
==17615==    by 0x73B5B0: asio::io_service::run_one() (io_service.ipp:69)
==17615==    by 0x74C1EA: RCF::AsioMuxer::cycle(int) (ThreadPool.cpp:181)
==17615==    by 0x7117D1: RCF::ThreadPool::cycle(int, RCF::ShouldStop&) (ThreadPool.cpp:523)
==17615==    by 0x711926: RCF::ThreadPool::repeatTask(boost::shared_ptr<RCF::ThreadInfo>, int) (ThreadPool.cpp:555)
==17615==    by 0x8DDE4E: boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>::operator()(RCF::ThreadPool*, boost::shared_ptr<RCF::ThreadInfo>, int) const (mem_fn_template.hpp:280)
==17615==    by 0x8DD481: void boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> >::operator()<boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list0>(boost::_bi::type<void>, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>&, boost::_bi::list0&, int) (bind.hpp:392)
==17615==    by 0x8DC207: boost::_bi::bind_t<void, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> > >::operator()() (bind_template.hpp:20)
==17615==    by 0x8D6A19: RCF::detail::posix_thread::func<boost::_bi::bind_t<void, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> > > >::run() (posix_thread.hpp:96)
==17615==    by 0x737A78: RCF_detail_posix_thread_function (posix_thread.ipp:74)
==17615==    by 0x4E39DA5: start_thread (pthread_create.c:305)
==17615==    by 0x5B46ABC: clone (clone.S:115)
==17615== 
==17615== 40 bytes in 1 blocks are still reachable in loss record 2 of 11
==17615==    at 0x4C2AA57: operator new(unsigned long) (vg_replace_malloc.c:287)
==17615==    by 0x70E9D6: RCF::getRootMutex() (ThreadLibrary.cpp:30)
==17615==    by 0x6DE7B8: RCF::init() (InitDeinit.cpp:90)
==17615==    by 0x6DEBA3: RCF::RcfInitDeinit::RcfInitDeinit() (InitDeinit.cpp:218)
==17615==    by 0x67A4D0: main (Server.cpp:26)
==17615== 
==17615== 96 bytes in 4 blocks are definitely lost in loss record 3 of 11
==17615==    at 0x4C2AA57: operator new(unsigned long) (vg_replace_malloc.c:287)
==17615==    by 0x75FD83: RCF::ThreadLocalCached<std::vector<boost::function1<void, RCF::RcfSession&>, std::allocator<boost::function1<void, RCF::RcfSession&> > > >::ThreadLocalCached() (ThreadLocalData.hpp:129)
==17615==    by 0x6FAA33: RCF::RcfSession::onWriteCompleted() (RcfServer.cpp:614)
==17615==    by 0x6FA71D: RCF::RcfServer::onWriteCompleted(boost::shared_ptr<RCF::RcfSession>) (RcfServer.cpp:582)
==17615==    by 0x7235A1: RCF::AsioSessionState::onAppReadWriteCompleted(unsigned long) (AsioServerTransport.cpp:801)
==17615==    by 0x721D21: RCF::AsioSessionState::onAcceptCompleted(asio::error_code const&) (AsioServerTransport.cpp:620)
==17615==    by 0x7F9FE4: void boost::_mfi::mf1<void, RCF::AsioSessionState, asio::error_code const&>::call<boost::shared_ptr<RCF::AsioSessionState>, asio::error_code const>(boost::shared_ptr<RCF::AsioSessionState>&, void const*, asio::error_code const&) const (mem_fn_template.hpp:156)
==17615==    by 0x7EBB99: void boost::_mfi::mf1<void, RCF::AsioSessionState, asio::error_code const&>::operator()<boost::shared_ptr<RCF::AsioSessionState> >(boost::shared_ptr<RCF::AsioSessionState>&, asio::error_code const&) const (mem_fn_template.hpp:171)
==17615==    by 0x7EACF0: void boost::_bi::list2<boost::_bi::value<boost::shared_ptr<RCF::AsioSessionState> >, boost::arg<1> (*)()>::operator()<boost::_mfi::mf1<void, RCF::AsioSessionState, asio::error_code const&>, boost::_bi::list1<asio::error_code const&> >(boost::_bi::type<void>, boost::_mfi::mf1<void, RCF::AsioSessionState, asio::error_code const&>&, boost::_bi::list1<asio::error_code const&>&, int) (bind.hpp:313)
==17615==    by 0x7E9C18: void boost::_bi::bind_t<void, boost::_mfi::mf1<void, RCF::AsioSessionState, asio::error_code const&>, boost::_bi::list2<boost::_bi::value<boost::shared_ptr<RCF::AsioSessionState> >, boost::arg<1> (*)()> >::operator()<asio::error_code>(asio::error_code const&) (bind_template.hpp:47)
==17615==    by 0x7E85FE: asio::detail::binder1<boost::_bi::bind_t<void, boost::_mfi::mf1<void, RCF::AsioSessionState, asio::error_code const&>, boost::_bi::list2<boost::_bi::value<boost::shared_ptr<RCF::AsioSessionState> >, boost::arg<1> (*)()> >, asio::error_code>::operator()() (bind_handler.hpp:39)
==17615==    by 0x7E5A27: void asio::asio_handler_invoke<asio::detail::binder1<boost::_bi::bind_t<void, boost::_mfi::mf1<void, RCF::AsioSessionState, asio::error_code const&>, boost::_bi::list2<boost::_bi::value<boost::shared_ptr<RCF::AsioSessionState> >, boost::arg<1> (*)()> >, asio::error_code> >(asio::detail::binder1<boost::_bi::bind_t<void, boost::_mfi::mf1<void, RCF::AsioSessionState, asio::error_code const&>, boost::_bi::list2<boost::_bi::value<boost::shared_ptr<RCF::AsioSessionState> >, boost::arg<1> (*)()> >, asio::error_code>, ...) (handler_invoke_hook.hpp:63)
==17615==    by 0x7E17FD: void asio_handler_invoke_helpers::invoke<asio::detail::binder1<boost::_bi::bind_t<void, boost::_mfi::mf1<void, RCF::AsioSessionState, asio::error_code const&>, boost::_bi::list2<boost::_bi::value<boost::shared_ptr<RCF::AsioSessionState> >, boost::arg<1> (*)()> >, asio::error_code>, boost::_bi::bind_t<void, boost::_mfi::mf1<void, RCF::AsioSessionState, asio::error_code const&>, boost::_bi::list2<boost::_bi::value<boost::shared_ptr<RCF::AsioSessionState> >, boost::arg<1> (*)()> > >(asio::detail::binder1<boost::_bi::bind_t<void, boost::_mfi::mf1<void, RCF::AsioSessionState, asio::error_code const&>, boost::_bi::list2<boost::_bi::value<boost::shared_ptr<RCF::AsioSessionState> >, boost::arg<1> (*)()> >, asio::error_code> const&, boost::_bi::bind_t<void, boost::_mfi::mf1<void, RCF::AsioSessionState, asio::error_code const&>, boost::_bi::list2<boost::_bi::value<boost::shared_ptr<RCF::AsioSessionState> >, boost::arg<1> (*)()> >&) (handler_invoke_helpers.hpp:39)
==17615==    by 0x7D933A: asio::detail::reactive_socket_accept_op<asio::basic_socket<asio::ip::tcp, asio::stream_socket_service<asio::ip::tcp> >, asio::ip::tcp, boost::_bi::bind_t<void, boost::_mfi::mf1<void, RCF::AsioSessionState, asio::error_code const&>, boost::_bi::list2<boost::_bi::value<boost::shared_ptr<RCF::AsioSessionState> >, boost::arg<1> (*)()> > >::do_complete(asio::detail::task_io_service*, asio::detail::task_io_service_operation*, asio::error_code, unsigned long) (reactive_socket_accept_op.hpp:118)
==17615==    by 0x7391A0: asio::detail::task_io_service_operation::complete(asio::detail::task_io_service&) (task_io_service_operation.hpp:34)
==17615==    by 0x73B1FD: asio::detail::task_io_service::do_one(asio::detail::scoped_lock<asio::detail::posix_mutex>&, asio::detail::task_io_service::idle_thread_info*) (task_io_service.ipp:277)
==17615==    by 0x73AC79: asio::detail::task_io_service::run_one(asio::error_code&) (task_io_service.ipp:151)
==17615==    by 0x73B5B0: asio::io_service::run_one() (io_service.ipp:69)
==17615==    by 0x74C1EA: RCF::AsioMuxer::cycle(int) (ThreadPool.cpp:181)
==17615==    by 0x7117D1: RCF::ThreadPool::cycle(int, RCF::ShouldStop&) (ThreadPool.cpp:523)
==17615==    by 0x711926: RCF::ThreadPool::repeatTask(boost::shared_ptr<RCF::ThreadInfo>, int) (ThreadPool.cpp:555)
==17615==    by 0x8DDE4E: boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>::operator()(RCF::ThreadPool*, boost::shared_ptr<RCF::ThreadInfo>, int) const (mem_fn_template.hpp:280)
==17615==    by 0x8DD481: void boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> >::operator()<boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list0>(boost::_bi::type<void>, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>&, boost::_bi::list0&, int) (bind.hpp:392)
==17615==    by 0x8DC207: boost::_bi::bind_t<void, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> > >::operator()() (bind_template.hpp:20)
==17615==    by 0x8D6A19: RCF::detail::posix_thread::func<boost::_bi::bind_t<void, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> > > >::run() (posix_thread.hpp:96)
==17615==    by 0x737A78: RCF_detail_posix_thread_function (posix_thread.ipp:74)
==17615==    by 0x4E39DA5: start_thread (pthread_create.c:305)
==17615==    by 0x5B46ABC: clone (clone.S:115)
==17615== 
==17615== 120 bytes in 5 blocks are definitely lost in loss record 4 of 11
==17615==    at 0x4C2AA57: operator new(unsigned long) (vg_replace_malloc.c:287)
==17615==    by 0x759D23: RCF::ThreadLocalCached<std::vector<boost::shared_ptr<RCF::Filter>, std::allocator<boost::shared_ptr<RCF::Filter> > > >::ThreadLocalCached() (ThreadLocalData.hpp:129)
==17615==    by 0x6EA476: RCF::MethodInvocationRequest::decodeRequest(RCF::ByteBuffer const&, RCF::ByteBuffer&, boost::shared_ptr<RCF::RcfSession>, RCF::RcfServer&) (MethodInvocation.cpp:229)
==17615==    by 0x6FA2FE: RCF::RcfSession::onReadCompleted() (RcfServer.cpp:524)
==17615==    by 0x75FB80: void RCF::applyRecursionLimiter<RCF::RecursionState<int, int>, RCF::RcfSession, void (RCF::RcfSession::*)()>(RCF::RecursionState<int, int>&, void (RCF::RcfSession::*)(), RCF::RcfSession&) (RecursionLimiter.hpp:119)
==17615==    by 0x6FA0D2: RCF::RcfServer::onReadCompleted(boost::shared_ptr<RCF::RcfSession>) (RcfServer.cpp:476)
==17615==    by 0x722661: RCF::AsioSessionState::doRegularFraming(unsigned long) (AsioServerTransport.cpp:696)
==17615==    by 0x7232FE: RCF::AsioSessionState::onAppReadWriteCompleted(unsigned long) (AsioServerTransport.cpp:770)
==17615==    by 0x720DD6: RCF::AsioSessionState::onNetworkReadCompleted(asio::error_code, unsigned long) (AsioServerTransport.cpp:444)
==17615==    by 0x71ECAA: RCF::ReadHandler::operator()(asio::error_code, unsigned long) (AsioServerTransport.cpp:93)
==17615==    by 0x7E82D1: asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long>::operator()() (bind_handler.hpp:96)
==17615==    by 0x7E56C3: void asio::asio_handler_invoke<asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long> >(asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long>, ...) (handler_invoke_hook.hpp:63)
==17615==    by 0x7E1355: void asio_handler_invoke_helpers::invoke<asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long>, RCF::ReadHandler>(asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long> const&, RCF::ReadHandler&) (handler_invoke_helpers.hpp:39)
==17615==    by 0x7D8DBD: asio::detail::reactive_socket_recv_op<asio::mutable_buffers_1, RCF::ReadHandler>::do_complete(asio::detail::task_io_service*, asio::detail::task_io_service_operation*, asio::error_code, unsigned long) (reactive_socket_recv_op.hpp:105)
==17615==    by 0x7391A0: asio::detail::task_io_service_operation::complete(asio::detail::task_io_service&) (task_io_service_operation.hpp:34)
==17615==    by 0x73B1FD: asio::detail::task_io_service::do_one(asio::detail::scoped_lock<asio::detail::posix_mutex>&, asio::detail::task_io_service::idle_thread_info*) (task_io_service.ipp:277)
==17615==    by 0x73AC79: asio::detail::task_io_service::run_one(asio::error_code&) (task_io_service.ipp:151)
==17615==    by 0x73B5B0: asio::io_service::run_one() (io_service.ipp:69)
==17615==    by 0x74C1EA: RCF::AsioMuxer::cycle(int) (ThreadPool.cpp:181)
==17615==    by 0x7117D1: RCF::ThreadPool::cycle(int, RCF::ShouldStop&) (ThreadPool.cpp:523)
==17615==    by 0x711926: RCF::ThreadPool::repeatTask(boost::shared_ptr<RCF::ThreadInfo>, int) (ThreadPool.cpp:555)
==17615==    by 0x8DDE4E: boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>::operator()(RCF::ThreadPool*, boost::shared_ptr<RCF::ThreadInfo>, int) const (mem_fn_template.hpp:280)
==17615==    by 0x8DD481: void boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> >::operator()<boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list0>(boost::_bi::type<void>, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>&, boost::_bi::list0&, int) (bind.hpp:392)
==17615==    by 0x8DC207: boost::_bi::bind_t<void, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> > >::operator()() (bind_template.hpp:20)
==17615==    by 0x8D6A19: RCF::detail::posix_thread::func<boost::_bi::bind_t<void, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> > > >::run() (posix_thread.hpp:96)
==17615==    by 0x737A78: RCF_detail_posix_thread_function (posix_thread.ipp:74)
==17615==    by 0x4E39DA5: start_thread (pthread_create.c:305)
==17615==    by 0x5B46ABC: clone (clone.S:115)
==17615== 
==17615== 120 bytes in 5 blocks are definitely lost in loss record 5 of 11
==17615==    at 0x4C2AA57: operator new(unsigned long) (vg_replace_malloc.c:287)
==17615==    by 0x75A289: RCF::ThreadLocalCached<std::vector<int, std::allocator<int> > >::ThreadLocalCached() (ThreadLocalData.hpp:129)
==17615==    by 0x6EDD50: RCF::MethodInvocationRequest::decodeFromMessage(RCF::ByteBuffer const&, RCF::ByteBuffer&, RCF::RcfServer*, boost::shared_ptr<RCF::RcfSession>, std::vector<boost::shared_ptr<RCF::Filter>, std::allocator<boost::shared_ptr<RCF::Filter> > > const&) (MethodInvocation.cpp:796)
==17615==    by 0x6EA4DA: RCF::MethodInvocationRequest::decodeRequest(RCF::ByteBuffer const&, RCF::ByteBuffer&, boost::shared_ptr<RCF::RcfSession>, RCF::RcfServer&) (MethodInvocation.cpp:238)
==17615==    by 0x6FA2FE: RCF::RcfSession::onReadCompleted() (RcfServer.cpp:524)
==17615==    by 0x75FB80: void RCF::applyRecursionLimiter<RCF::RecursionState<int, int>, RCF::RcfSession, void (RCF::RcfSession::*)()>(RCF::RecursionState<int, int>&, void (RCF::RcfSession::*)(), RCF::RcfSession&) (RecursionLimiter.hpp:119)
==17615==    by 0x6FA0D2: RCF::RcfServer::onReadCompleted(boost::shared_ptr<RCF::RcfSession>) (RcfServer.cpp:476)
==17615==    by 0x722661: RCF::AsioSessionState::doRegularFraming(unsigned long) (AsioServerTransport.cpp:696)
==17615==    by 0x7232FE: RCF::AsioSessionState::onAppReadWriteCompleted(unsigned long) (AsioServerTransport.cpp:770)
==17615==    by 0x720DD6: RCF::AsioSessionState::onNetworkReadCompleted(asio::error_code, unsigned long) (AsioServerTransport.cpp:444)
==17615==    by 0x71ECAA: RCF::ReadHandler::operator()(asio::error_code, unsigned long) (AsioServerTransport.cpp:93)
==17615==    by 0x7E82D1: asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long>::operator()() (bind_handler.hpp:96)
==17615==    by 0x7E56C3: void asio::asio_handler_invoke<asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long> >(asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long>, ...) (handler_invoke_hook.hpp:63)
==17615==    by 0x7E1355: void asio_handler_invoke_helpers::invoke<asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long>, RCF::ReadHandler>(asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long> const&, RCF::ReadHandler&) (handler_invoke_helpers.hpp:39)
==17615==    by 0x7D8DBD: asio::detail::reactive_socket_recv_op<asio::mutable_buffers_1, RCF::ReadHandler>::do_complete(asio::detail::task_io_service*, asio::detail::task_io_service_operation*, asio::error_code, unsigned long) (reactive_socket_recv_op.hpp:105)
==17615==    by 0x7391A0: asio::detail::task_io_service_operation::complete(asio::detail::task_io_service&) (task_io_service_operation.hpp:34)
==17615==    by 0x73B1FD: asio::detail::task_io_service::do_one(asio::detail::scoped_lock<asio::detail::posix_mutex>&, asio::detail::task_io_service::idle_thread_info*) (task_io_service.ipp:277)
==17615==    by 0x73AC79: asio::detail::task_io_service::run_one(asio::error_code&) (task_io_service.ipp:151)
==17615==    by 0x73B5B0: asio::io_service::run_one() (io_service.ipp:69)
==17615==    by 0x74C1EA: RCF::AsioMuxer::cycle(int) (ThreadPool.cpp:181)
==17615==    by 0x7117D1: RCF::ThreadPool::cycle(int, RCF::ShouldStop&) (ThreadPool.cpp:523)
==17615==    by 0x711926: RCF::ThreadPool::repeatTask(boost::shared_ptr<RCF::ThreadInfo>, int) (ThreadPool.cpp:555)
==17615==    by 0x8DDE4E: boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>::operator()(RCF::ThreadPool*, boost::shared_ptr<RCF::ThreadInfo>, int) const (mem_fn_template.hpp:280)
==17615==    by 0x8DD481: void boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> >::operator()<boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list0>(boost::_bi::type<void>, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>&, boost::_bi::list0&, int) (bind.hpp:392)
==17615==    by 0x8DC207: boost::_bi::bind_t<void, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> > >::operator()() (bind_template.hpp:20)
==17615==    by 0x8D6A19: RCF::detail::posix_thread::func<boost::_bi::bind_t<void, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> > > >::run() (posix_thread.hpp:96)
==17615==    by 0x737A78: RCF_detail_posix_thread_function (posix_thread.ipp:74)
==17615==    by 0x4E39DA5: start_thread (pthread_create.c:305)
==17615==    by 0x5B46ABC: clone (clone.S:115)
==17615== 
==17615== 400 bytes in 5 blocks are indirectly lost in loss record 6 of 11
==17615==    at 0x4C2AA57: operator new(unsigned long) (vg_replace_malloc.c:287)
==17615==    by 0x7BCBBB: __gnu_cxx::new_allocator<RCF::ByteBuffer>::allocate(unsigned long, void const*) (new_allocator.h:89)
==17615==    by 0x79E482: std::_Vector_base<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> >::_M_allocate(unsigned long) (in /home/cinsk/src/rcf/demo/cmake/bin/Server)
==17615==    by 0x77EC7A: std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> >::_M_insert_aux(__gnu_cxx::__normal_iterator<RCF::ByteBuffer*, std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> > >, RCF::ByteBuffer const&) (vector.tcc:322)
==17615==    by 0x752E8F: std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> >::push_back(RCF::ByteBuffer const&) (stl_vector.h:749)
==17615==    by 0x704842: RCF::SerializationProtocolOut::extractByteBuffers(std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> >&) (SerializationProtocol.cpp:386)
==17615==    by 0x6FAC94: RCF::RcfSession::sendSessionResponse() (RcfServer.cpp:642)
==17615==    by 0x6FB95B: RCF::RcfSession::sendResponse() (RcfServer.cpp:767)
==17615==    by 0x6FD222: RCF::RcfSession::processRequest() (RcfServer.cpp:1037)
==17615==    by 0x6FA5D9: RCF::RcfSession::onReadCompleted() (RcfServer.cpp:573)
==17615==    by 0x75FB80: void RCF::applyRecursionLimiter<RCF::RecursionState<int, int>, RCF::RcfSession, void (RCF::RcfSession::*)()>(RCF::RecursionState<int, int>&, void (RCF::RcfSession::*)(), RCF::RcfSession&) (RecursionLimiter.hpp:119)
==17615==    by 0x6FA0D2: RCF::RcfServer::onReadCompleted(boost::shared_ptr<RCF::RcfSession>) (RcfServer.cpp:476)
==17615==    by 0x722661: RCF::AsioSessionState::doRegularFraming(unsigned long) (AsioServerTransport.cpp:696)
==17615==    by 0x7232FE: RCF::AsioSessionState::onAppReadWriteCompleted(unsigned long) (AsioServerTransport.cpp:770)
==17615==    by 0x720DD6: RCF::AsioSessionState::onNetworkReadCompleted(asio::error_code, unsigned long) (AsioServerTransport.cpp:444)
==17615==    by 0x71ECAA: RCF::ReadHandler::operator()(asio::error_code, unsigned long) (AsioServerTransport.cpp:93)
==17615==    by 0x7E82D1: asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long>::operator()() (bind_handler.hpp:96)
==17615==    by 0x7E56C3: void asio::asio_handler_invoke<asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long> >(asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long>, ...) (handler_invoke_hook.hpp:63)
==17615==    by 0x7E1355: void asio_handler_invoke_helpers::invoke<asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long>, RCF::ReadHandler>(asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long> const&, RCF::ReadHandler&) (handler_invoke_helpers.hpp:39)
==17615==    by 0x7D8DBD: asio::detail::reactive_socket_recv_op<asio::mutable_buffers_1, RCF::ReadHandler>::do_complete(asio::detail::task_io_service*, asio::detail::task_io_service_operation*, asio::error_code, unsigned long) (reactive_socket_recv_op.hpp:105)
==17615==    by 0x7391A0: asio::detail::task_io_service_operation::complete(asio::detail::task_io_service&) (task_io_service_operation.hpp:34)
==17615==    by 0x73B1FD: asio::detail::task_io_service::do_one(asio::detail::scoped_lock<asio::detail::posix_mutex>&, asio::detail::task_io_service::idle_thread_info*) (task_io_service.ipp:277)
==17615==    by 0x73AC79: asio::detail::task_io_service::run_one(asio::error_code&) (task_io_service.ipp:151)
==17615==    by 0x73B5B0: asio::io_service::run_one() (io_service.ipp:69)
==17615==    by 0x74C1EA: RCF::AsioMuxer::cycle(int) (ThreadPool.cpp:181)
==17615==    by 0x7117D1: RCF::ThreadPool::cycle(int, RCF::ShouldStop&) (ThreadPool.cpp:523)
==17615==    by 0x711926: RCF::ThreadPool::repeatTask(boost::shared_ptr<RCF::ThreadInfo>, int) (ThreadPool.cpp:555)
==17615==    by 0x8DDE4E: boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>::operator()(RCF::ThreadPool*, boost::shared_ptr<RCF::ThreadInfo>, int) const (mem_fn_template.hpp:280)
==17615==    by 0x8DD481: void boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> >::operator()<boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list0>(boost::_bi::type<void>, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>&, boost::_bi::list0&, int) (bind.hpp:392)
==17615==    by 0x8DC207: boost::_bi::bind_t<void, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> > >::operator()() (bind_template.hpp:20)
==17615==    by 0x8D6A19: RCF::detail::posix_thread::func<boost::_bi::bind_t<void, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> > > >::run() (posix_thread.hpp:96)
==17615==    by 0x737A78: RCF_detail_posix_thread_function (posix_thread.ipp:74)
==17615==    by 0x4E39DA5: start_thread (pthread_create.c:305)
==17615==    by 0x5B46ABC: clone (clone.S:115)
==17615== 
==17615== 400 bytes in 5 blocks are indirectly lost in loss record 7 of 11
==17615==    at 0x4C2AA57: operator new(unsigned long) (vg_replace_malloc.c:287)
==17615==    by 0x7BCBBB: __gnu_cxx::new_allocator<RCF::ByteBuffer>::allocate(unsigned long, void const*) (new_allocator.h:89)
==17615==    by 0x79E482: std::_Vector_base<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> >::_M_allocate(unsigned long) (in /home/cinsk/src/rcf/demo/cmake/bin/Server)
==17615==    by 0x77EC7A: std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> >::_M_insert_aux(__gnu_cxx::__normal_iterator<RCF::ByteBuffer*, std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> > >, RCF::ByteBuffer const&) (vector.tcc:322)
==17615==    by 0x752E8F: std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> >::push_back(RCF::ByteBuffer const&) (stl_vector.h:749)
==17615==    by 0x7D1207: std::back_insert_iterator<std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> > >::operator=(RCF::ByteBuffer const&) (stl_iterator.h:423)
==17615==    by 0x7BD9C4: std::back_insert_iterator<std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> > > std::__copy_move<false, false, std::random_access_iterator_tag>::__copy_m<RCF::ByteBuffer const*, std::back_insert_iterator<std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> > > >(RCF::ByteBuffer const*, RCF::ByteBuffer const*, std::back_insert_iterator<std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> > >) (stl_algobase.h:349)
==17615==    by 0x7A02AC: std::back_insert_iterator<std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> > > std::__copy_move_a<false, RCF::ByteBuffer const*, std::back_insert_iterator<std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> > > >(RCF::ByteBuffer const*, RCF::ByteBuffer const*, std::back_insert_iterator<std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> > >) (stl_algobase.h:404)
==17615==    by 0x780FBB: std::back_insert_iterator<std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> > > std::__copy_move_a2<false, __gnu_cxx::__normal_iterator<RCF::ByteBuffer const*, std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> > >, std::back_insert_iterator<std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> > > >(__gnu_cxx::__normal_iterator<RCF::ByteBuffer const*, std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> > >, __gnu_cxx::__normal_iterator<RCF::ByteBuffer const*, std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> > >, std::back_insert_iterator<std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> > >) (stl_algobase.h:442)
==17615==    by 0x7550DC: std::back_insert_iterator<std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> > > std::copy<__gnu_cxx::__normal_iterator<RCF::ByteBuffer const*, std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> > >, std::back_insert_iterator<std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> > > >(__gnu_cxx::__normal_iterator<RCF::ByteBuffer const*, std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> > >, __gnu_cxx::__normal_iterator<RCF::ByteBuffer const*, std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> > >, std::back_insert_iterator<std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> > >) (stl_algobase.h:474)
==17615==    by 0x6ECE3E: RCF::MethodInvocationRequest::encodeToMessage(std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> >&, std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> > const&, std::vector<boost::shared_ptr<RCF::Filter>, std::allocator<boost::shared_ptr<RCF::Filter> > > const&) (MethodInvocation.cpp:696)
==17615==    by 0x6FAD26: RCF::RcfSession::sendSessionResponse() (RcfServer.cpp:653)
==17615==    by 0x6FB95B: RCF::RcfSession::sendResponse() (RcfServer.cpp:767)
==17615==    by 0x6FD222: RCF::RcfSession::processRequest() (RcfServer.cpp:1037)
==17615==    by 0x6FA5D9: RCF::RcfSession::onReadCompleted() (RcfServer.cpp:573)
==17615==    by 0x75FB80: void RCF::applyRecursionLimiter<RCF::RecursionState<int, int>, RCF::RcfSession, void (RCF::RcfSession::*)()>(RCF::RecursionState<int, int>&, void (RCF::RcfSession::*)(), RCF::RcfSession&) (RecursionLimiter.hpp:119)
==17615==    by 0x6FA0D2: RCF::RcfServer::onReadCompleted(boost::shared_ptr<RCF::RcfSession>) (RcfServer.cpp:476)
==17615==    by 0x722661: RCF::AsioSessionState::doRegularFraming(unsigned long) (AsioServerTransport.cpp:696)
==17615==    by 0x7232FE: RCF::AsioSessionState::onAppReadWriteCompleted(unsigned long) (AsioServerTransport.cpp:770)
==17615==    by 0x720DD6: RCF::AsioSessionState::onNetworkReadCompleted(asio::error_code, unsigned long) (AsioServerTransport.cpp:444)
==17615==    by 0x71ECAA: RCF::ReadHandler::operator()(asio::error_code, unsigned long) (AsioServerTransport.cpp:93)
==17615==    by 0x7E82D1: asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long>::operator()() (bind_handler.hpp:96)
==17615==    by 0x7E56C3: void asio::asio_handler_invoke<asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long> >(asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long>, ...) (handler_invoke_hook.hpp:63)
==17615==    by 0x7E1355: void asio_handler_invoke_helpers::invoke<asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long>, RCF::ReadHandler>(asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long> const&, RCF::ReadHandler&) (handler_invoke_helpers.hpp:39)
==17615==    by 0x7D8DBD: asio::detail::reactive_socket_recv_op<asio::mutable_buffers_1, RCF::ReadHandler>::do_complete(asio::detail::task_io_service*, asio::detail::task_io_service_operation*, asio::error_code, unsigned long) (reactive_socket_recv_op.hpp:105)
==17615==    by 0x7391A0: asio::detail::task_io_service_operation::complete(asio::detail::task_io_service&) (task_io_service_operation.hpp:34)
==17615==    by 0x73B1FD: asio::detail::task_io_service::do_one(asio::detail::scoped_lock<asio::detail::posix_mutex>&, asio::detail::task_io_service::idle_thread_info*) (task_io_service.ipp:277)
==17615==    by 0x73AC79: asio::detail::task_io_service::run_one(asio::error_code&) (task_io_service.ipp:151)
==17615==    by 0x73B5B0: asio::io_service::run_one() (io_service.ipp:69)
==17615==    by 0x74C1EA: RCF::AsioMuxer::cycle(int) (ThreadPool.cpp:181)
==17615==    by 0x7117D1: RCF::ThreadPool::cycle(int, RCF::ShouldStop&) (ThreadPool.cpp:523)
==17615==    by 0x711926: RCF::ThreadPool::repeatTask(boost::shared_ptr<RCF::ThreadInfo>, int) (ThreadPool.cpp:555)
==17615==    by 0x8DDE4E: boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>::operator()(RCF::ThreadPool*, boost::shared_ptr<RCF::ThreadInfo>, int) const (mem_fn_template.hpp:280)
==17615==    by 0x8DD481: void boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> >::operator()<boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list0>(boost::_bi::type<void>, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>&, boost::_bi::list0&, int) (bind.hpp:392)
==17615==    by 0x8DC207: boost::_bi::bind_t<void, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> > >::operator()() (bind_template.hpp:20)
==17615==    by 0x8D6A19: RCF::detail::posix_thread::func<boost::_bi::bind_t<void, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> > > >::run() (posix_thread.hpp:96)
==17615==    by 0x737A78: RCF_detail_posix_thread_function (posix_thread.ipp:74)
==17615==    by 0x4E39DA5: start_thread (pthread_create.c:305)
==17615==    by 0x5B46ABC: clone (clone.S:115)
==17615== 
==17615== 520 (120 direct, 400 indirect) bytes in 5 blocks are definitely lost in loss record 8 of 11
==17615==    at 0x4C2AA57: operator new(unsigned long) (vg_replace_malloc.c:287)
==17615==    by 0x7570F9: RCF::ThreadLocalCached<std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> > >::ThreadLocalCached() (ThreadLocalData.hpp:129)
==17615==    by 0x6FAC64: RCF::RcfSession::sendSessionResponse() (RcfServer.cpp:639)
==17615==    by 0x6FB95B: RCF::RcfSession::sendResponse() (RcfServer.cpp:767)
==17615==    by 0x6FD222: RCF::RcfSession::processRequest() (RcfServer.cpp:1037)
==17615==    by 0x6FA5D9: RCF::RcfSession::onReadCompleted() (RcfServer.cpp:573)
==17615==    by 0x75FB80: void RCF::applyRecursionLimiter<RCF::RecursionState<int, int>, RCF::RcfSession, void (RCF::RcfSession::*)()>(RCF::RecursionState<int, int>&, void (RCF::RcfSession::*)(), RCF::RcfSession&) (RecursionLimiter.hpp:119)
==17615==    by 0x6FA0D2: RCF::RcfServer::onReadCompleted(boost::shared_ptr<RCF::RcfSession>) (RcfServer.cpp:476)
==17615==    by 0x722661: RCF::AsioSessionState::doRegularFraming(unsigned long) (AsioServerTransport.cpp:696)
==17615==    by 0x7232FE: RCF::AsioSessionState::onAppReadWriteCompleted(unsigned long) (AsioServerTransport.cpp:770)
==17615==    by 0x720DD6: RCF::AsioSessionState::onNetworkReadCompleted(asio::error_code, unsigned long) (AsioServerTransport.cpp:444)
==17615==    by 0x71ECAA: RCF::ReadHandler::operator()(asio::error_code, unsigned long) (AsioServerTransport.cpp:93)
==17615==    by 0x7E82D1: asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long>::operator()() (bind_handler.hpp:96)
==17615==    by 0x7E56C3: void asio::asio_handler_invoke<asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long> >(asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long>, ...) (handler_invoke_hook.hpp:63)
==17615==    by 0x7E1355: void asio_handler_invoke_helpers::invoke<asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long>, RCF::ReadHandler>(asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long> const&, RCF::ReadHandler&) (handler_invoke_helpers.hpp:39)
==17615==    by 0x7D8DBD: asio::detail::reactive_socket_recv_op<asio::mutable_buffers_1, RCF::ReadHandler>::do_complete(asio::detail::task_io_service*, asio::detail::task_io_service_operation*, asio::error_code, unsigned long) (reactive_socket_recv_op.hpp:105)
==17615==    by 0x7391A0: asio::detail::task_io_service_operation::complete(asio::detail::task_io_service&) (task_io_service_operation.hpp:34)
==17615==    by 0x73B1FD: asio::detail::task_io_service::do_one(asio::detail::scoped_lock<asio::detail::posix_mutex>&, asio::detail::task_io_service::idle_thread_info*) (task_io_service.ipp:277)
==17615==    by 0x73AC79: asio::detail::task_io_service::run_one(asio::error_code&) (task_io_service.ipp:151)
==17615==    by 0x73B5B0: asio::io_service::run_one() (io_service.ipp:69)
==17615==    by 0x74C1EA: RCF::AsioMuxer::cycle(int) (ThreadPool.cpp:181)
==17615==    by 0x7117D1: RCF::ThreadPool::cycle(int, RCF::ShouldStop&) (ThreadPool.cpp:523)
==17615==    by 0x711926: RCF::ThreadPool::repeatTask(boost::shared_ptr<RCF::ThreadInfo>, int) (ThreadPool.cpp:555)
==17615==    by 0x8DDE4E: boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>::operator()(RCF::ThreadPool*, boost::shared_ptr<RCF::ThreadInfo>, int) const (mem_fn_template.hpp:280)
==17615==    by 0x8DD481: void boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> >::operator()<boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list0>(boost::_bi::type<void>, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>&, boost::_bi::list0&, int) (bind.hpp:392)
==17615==    by 0x8DC207: boost::_bi::bind_t<void, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> > >::operator()() (bind_template.hpp:20)
==17615==    by 0x8D6A19: RCF::detail::posix_thread::func<boost::_bi::bind_t<void, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> > > >::run() (posix_thread.hpp:96)
==17615==    by 0x737A78: RCF_detail_posix_thread_function (posix_thread.ipp:74)
==17615==    by 0x4E39DA5: start_thread (pthread_create.c:305)
==17615==    by 0x5B46ABC: clone (clone.S:115)
==17615== 
==17615== 520 (120 direct, 400 indirect) bytes in 5 blocks are definitely lost in loss record 9 of 11
==17615==    at 0x4C2AA57: operator new(unsigned long) (vg_replace_malloc.c:287)
==17615==    by 0x7570F9: RCF::ThreadLocalCached<std::vector<RCF::ByteBuffer, std::allocator<RCF::ByteBuffer> > >::ThreadLocalCached() (ThreadLocalData.hpp:129)
==17615==    by 0x6FACB4: RCF::RcfSession::sendSessionResponse() (RcfServer.cpp:644)
==17615==    by 0x6FB95B: RCF::RcfSession::sendResponse() (RcfServer.cpp:767)
==17615==    by 0x6FD222: RCF::RcfSession::processRequest() (RcfServer.cpp:1037)
==17615==    by 0x6FA5D9: RCF::RcfSession::onReadCompleted() (RcfServer.cpp:573)
==17615==    by 0x75FB80: void RCF::applyRecursionLimiter<RCF::RecursionState<int, int>, RCF::RcfSession, void (RCF::RcfSession::*)()>(RCF::RecursionState<int, int>&, void (RCF::RcfSession::*)(), RCF::RcfSession&) (RecursionLimiter.hpp:119)
==17615==    by 0x6FA0D2: RCF::RcfServer::onReadCompleted(boost::shared_ptr<RCF::RcfSession>) (RcfServer.cpp:476)
==17615==    by 0x722661: RCF::AsioSessionState::doRegularFraming(unsigned long) (AsioServerTransport.cpp:696)
==17615==    by 0x7232FE: RCF::AsioSessionState::onAppReadWriteCompleted(unsigned long) (AsioServerTransport.cpp:770)
==17615==    by 0x720DD6: RCF::AsioSessionState::onNetworkReadCompleted(asio::error_code, unsigned long) (AsioServerTransport.cpp:444)
==17615==    by 0x71ECAA: RCF::ReadHandler::operator()(asio::error_code, unsigned long) (AsioServerTransport.cpp:93)
==17615==    by 0x7E82D1: asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long>::operator()() (bind_handler.hpp:96)
==17615==    by 0x7E56C3: void asio::asio_handler_invoke<asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long> >(asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long>, ...) (handler_invoke_hook.hpp:63)
==17615==    by 0x7E1355: void asio_handler_invoke_helpers::invoke<asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long>, RCF::ReadHandler>(asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long> const&, RCF::ReadHandler&) (handler_invoke_helpers.hpp:39)
==17615==    by 0x7D8DBD: asio::detail::reactive_socket_recv_op<asio::mutable_buffers_1, RCF::ReadHandler>::do_complete(asio::detail::task_io_service*, asio::detail::task_io_service_operation*, asio::error_code, unsigned long) (reactive_socket_recv_op.hpp:105)
==17615==    by 0x7391A0: asio::detail::task_io_service_operation::complete(asio::detail::task_io_service&) (task_io_service_operation.hpp:34)
==17615==    by 0x73B1FD: asio::detail::task_io_service::do_one(asio::detail::scoped_lock<asio::detail::posix_mutex>&, asio::detail::task_io_service::idle_thread_info*) (task_io_service.ipp:277)
==17615==    by 0x73AC79: asio::detail::task_io_service::run_one(asio::error_code&) (task_io_service.ipp:151)
==17615==    by 0x73B5B0: asio::io_service::run_one() (io_service.ipp:69)
==17615==    by 0x74C1EA: RCF::AsioMuxer::cycle(int) (ThreadPool.cpp:181)
==17615==    by 0x7117D1: RCF::ThreadPool::cycle(int, RCF::ShouldStop&) (ThreadPool.cpp:523)
==17615==    by 0x711926: RCF::ThreadPool::repeatTask(boost::shared_ptr<RCF::ThreadInfo>, int) (ThreadPool.cpp:555)
==17615==    by 0x8DDE4E: boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>::operator()(RCF::ThreadPool*, boost::shared_ptr<RCF::ThreadInfo>, int) const (mem_fn_template.hpp:280)
==17615==    by 0x8DD481: void boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> >::operator()<boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list0>(boost::_bi::type<void>, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>&, boost::_bi::list0&, int) (bind.hpp:392)
==17615==    by 0x8DC207: boost::_bi::bind_t<void, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> > >::operator()() (bind_template.hpp:20)
==17615==    by 0x8D6A19: RCF::detail::posix_thread::func<boost::_bi::bind_t<void, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> > > >::run() (posix_thread.hpp:96)
==17615==    by 0x737A78: RCF_detail_posix_thread_function (posix_thread.ipp:74)
==17615==    by 0x4E39DA5: start_thread (pthread_create.c:305)
==17615==    by 0x5B46ABC: clone (clone.S:115)
==17615== 
==17615== 588 bytes in 7 blocks are indirectly lost in loss record 10 of 11
==17615==    at 0x4C2B042: realloc (vg_replace_malloc.c:632)
==17615==    by 0x7024C0: RCF::ReallocBuffer::resize(unsigned long) (ReallocBuffer.cpp:87)
==17615==    by 0x7225D0: RCF::AsioSessionState::doRegularFraming(unsigned long) (AsioServerTransport.cpp:685)
==17615==    by 0x7232FE: RCF::AsioSessionState::onAppReadWriteCompleted(unsigned long) (AsioServerTransport.cpp:770)
==17615==    by 0x720DD6: RCF::AsioSessionState::onNetworkReadCompleted(asio::error_code, unsigned long) (AsioServerTransport.cpp:444)
==17615==    by 0x71ECAA: RCF::ReadHandler::operator()(asio::error_code, unsigned long) (AsioServerTransport.cpp:93)
==17615==    by 0x7E82D1: asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long>::operator()() (bind_handler.hpp:96)
==17615==    by 0x7E56C3: void asio::asio_handler_invoke<asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long> >(asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long>, ...) (handler_invoke_hook.hpp:63)
==17615==    by 0x7E1355: void asio_handler_invoke_helpers::invoke<asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long>, RCF::ReadHandler>(asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long> const&, RCF::ReadHandler&) (handler_invoke_helpers.hpp:39)
==17615==    by 0x7D8DBD: asio::detail::reactive_socket_recv_op<asio::mutable_buffers_1, RCF::ReadHandler>::do_complete(asio::detail::task_io_service*, asio::detail::task_io_service_operation*, asio::error_code, unsigned long) (reactive_socket_recv_op.hpp:105)
==17615==    by 0x7391A0: asio::detail::task_io_service_operation::complete(asio::detail::task_io_service&) (task_io_service_operation.hpp:34)
==17615==    by 0x73B1FD: asio::detail::task_io_service::do_one(asio::detail::scoped_lock<asio::detail::posix_mutex>&, asio::detail::task_io_service::idle_thread_info*) (task_io_service.ipp:277)
==17615==    by 0x73AC79: asio::detail::task_io_service::run_one(asio::error_code&) (task_io_service.ipp:151)
==17615==    by 0x73B5B0: asio::io_service::run_one() (io_service.ipp:69)
==17615==    by 0x74C1EA: RCF::AsioMuxer::cycle(int) (ThreadPool.cpp:181)
==17615==    by 0x7117D1: RCF::ThreadPool::cycle(int, RCF::ShouldStop&) (ThreadPool.cpp:523)
==17615==    by 0x711926: RCF::ThreadPool::repeatTask(boost::shared_ptr<RCF::ThreadInfo>, int) (ThreadPool.cpp:555)
==17615==    by 0x8DDE4E: boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>::operator()(RCF::ThreadPool*, boost::shared_ptr<RCF::ThreadInfo>, int) const (mem_fn_template.hpp:280)
==17615==    by 0x8DD481: void boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> >::operator()<boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list0>(boost::_bi::type<void>, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>&, boost::_bi::list0&, int) (bind.hpp:392)
==17615==    by 0x8DC207: boost::_bi::bind_t<void, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> > >::operator()() (bind_template.hpp:20)
==17615==    by 0x8D6A19: RCF::detail::posix_thread::func<boost::_bi::bind_t<void, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> > > >::run() (posix_thread.hpp:96)
==17615==    by 0x737A78: RCF_detail_posix_thread_function (posix_thread.ipp:74)
==17615==    by 0x4E39DA5: start_thread (pthread_create.c:305)
==17615==    by 0x5B46ABC: clone (clone.S:115)
==17615== 
==17615== 756 (168 direct, 588 indirect) bytes in 7 blocks are definitely lost in loss record 11 of 11
==17615==    at 0x4C2AA57: operator new(unsigned long) (vg_replace_malloc.c:287)
==17615==    by 0x75C5A9: void RCF::ObjectPool::getPtr<RCF::ReallocBuffer, boost::shared_ptr<RCF::ReallocBuffer>, std::vector<RCF::ReallocBuffer*, std::allocator<RCF::ReallocBuffer*> >, void (RCF::ObjectPool::*)(RCF::ReallocBuffer*)>(RCF::ReallocBuffer*, boost::shared_ptr<RCF::ReallocBuffer>&, std::vector<RCF::ReallocBuffer*, std::allocator<RCF::ReallocBuffer*> >&, RCF::detail::posix_mutex&, void (RCF::ObjectPool::*)(RCF::ReallocBuffer*)) (ObjectPool.hpp:401)
==17615==    by 0x6F2F13: RCF::ObjectPool::getReallocBufferPtr() (ObjectPool.cpp:137)
==17615==    by 0x720C66: RCF::AsioSessionState::onNetworkReadCompleted(asio::error_code, unsigned long) (AsioServerTransport.cpp:421)
==17615==    by 0x71ECAA: RCF::ReadHandler::operator()(asio::error_code, unsigned long) (AsioServerTransport.cpp:93)
==17615==    by 0x7E82D1: asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long>::operator()() (bind_handler.hpp:96)
==17615==    by 0x7E56C3: void asio::asio_handler_invoke<asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long> >(asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long>, ...) (handler_invoke_hook.hpp:63)
==17615==    by 0x7E1355: void asio_handler_invoke_helpers::invoke<asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long>, RCF::ReadHandler>(asio::detail::binder2<RCF::ReadHandler, asio::error_code, unsigned long> const&, RCF::ReadHandler&) (handler_invoke_helpers.hpp:39)
==17615==    by 0x7D8DBD: asio::detail::reactive_socket_recv_op<asio::mutable_buffers_1, RCF::ReadHandler>::do_complete(asio::detail::task_io_service*, asio::detail::task_io_service_operation*, asio::error_code, unsigned long) (reactive_socket_recv_op.hpp:105)
==17615==    by 0x7391A0: asio::detail::task_io_service_operation::complete(asio::detail::task_io_service&) (task_io_service_operation.hpp:34)
==17615==    by 0x73B1FD: asio::detail::task_io_service::do_one(asio::detail::scoped_lock<asio::detail::posix_mutex>&, asio::detail::task_io_service::idle_thread_info*) (task_io_service.ipp:277)
==17615==    by 0x73AC79: asio::detail::task_io_service::run_one(asio::error_code&) (task_io_service.ipp:151)
==17615==    by 0x73B5B0: asio::io_service::run_one() (io_service.ipp:69)
==17615==    by 0x74C1EA: RCF::AsioMuxer::cycle(int) (ThreadPool.cpp:181)
==17615==    by 0x7117D1: RCF::ThreadPool::cycle(int, RCF::ShouldStop&) (ThreadPool.cpp:523)
==17615==    by 0x711926: RCF::ThreadPool::repeatTask(boost::shared_ptr<RCF::ThreadInfo>, int) (ThreadPool.cpp:555)
==17615==    by 0x8DDE4E: boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>::operator()(RCF::ThreadPool*, boost::shared_ptr<RCF::ThreadInfo>, int) const (mem_fn_template.hpp:280)
==17615==    by 0x8DD481: void boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> >::operator()<boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list0>(boost::_bi::type<void>, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>&, boost::_bi::list0&, int) (bind.hpp:392)
==17615==    by 0x8DC207: boost::_bi::bind_t<void, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> > >::operator()() (bind_template.hpp:20)
==17615==    by 0x8D6A19: RCF::detail::posix_thread::func<boost::_bi::bind_t<void, boost::_mfi::mf2<void, RCF::ThreadPool, boost::shared_ptr<RCF::ThreadInfo>, int>, boost::_bi::list3<boost::_bi::value<RCF::ThreadPool*>, boost::_bi::value<boost::shared_ptr<RCF::ThreadInfo> >, boost::_bi::value<int> > > >::run() (posix_thread.hpp:96)
==17615==    by 0x737A78: RCF_detail_posix_thread_function (posix_thread.ipp:74)
==17615==    by 0x4E39DA5: start_thread (pthread_create.c:305)
==17615==    by 0x5B46ABC: clone (clone.S:115)
==17615== 
==17615== LEAK SUMMARY:
==17615==    definitely lost: 768 bytes in 32 blocks
==17615==    indirectly lost: 1,388 bytes in 17 blocks
==17615==      possibly lost: 0 bytes in 0 blocks
==17615==    still reachable: 40 bytes in 1 blocks
==17615==         suppressed: 0 bytes in 0 blocks
==17615== 
==17615== For counts of detected and suppressed errors, rerun with: -v
==17615== ERROR SUMMARY: 7 errors from 7 contexts (suppressed: 2 from 2)

jarl
Posts: 238
Joined: Mon Oct 03, 2011 4:53 am
Contact:

Re: Possible memory leak on thread pool

Post by jarl »

I suspect you are seeing the buffer caching that RCF does in the background. RCF reuses network send and receive buffers, rather than asking the OS to allocate new ones.

To disable the caching, call ObjectPool::setBufferCountLimit() before starting your server:

#include <RCF/ObjectPool.hpp>

// ...

RCF::getObjectPool().setBufferCountLimit(0);


, and then see what valgrind reports.

The default behavior is for the RCF cache to hold up to 10 buffers, with up to 10 Mb in each buffer.
Kind Regards

Jarl Lindrud
Delta V Software
http://www.deltavsoft.com

Post Reply