Boost logo

Boost Users :

Subject: [Boost-users] Memory Leak with ASIO SSL examples on Linux in Boost 1.40
From: Madhan Kanagavel (madhan_at_[hidden])
Date: 2010-02-23 10:39:16


Hello,

We have been running a Boost ASIO 1.40 based server successfully for a while, handling hundreds of connections without any issues.
But we recently saw some unusual memory usage and started digging into it a bit.

We use Asynchronous IO with SSL.
We are seeing that in the server side every time a connection occurs some memory is being used up and never getting really freed after the connection goes away.
We use Resident Memory value of the server to measure memory usage of the server process.

This occurs only in Linux, works fine under Windows.

This is easy to reproduce: simply take the server sample and run it under Linux.

http://www.boost.org/doc/libs/1_37_0/doc/html/boost_asio/example/ssl/server.cpp
(The only change there being to make SSL verification to none.)

For the client side, make a lot of connections:
typedef boost::shared_ptr<client> client_ptr;
std::vector<client_ptr> clients;
for (int idx = 0; idx < 200; idx++)
    {
        client_ptr new_client(new client(io_service, ctx, iterator));
        clients.push_back(new_client);
    }

At the end of the client test program run, the server would have grown in memory by about 10 MB. If you run the client program again, by another 10 MB.
We also ran valgrind on the server side, but nothing significant showed up on where the memory is going.

Doing the same with non-SSL sample program works fine, no change in server memory.

If you need additional information, please let me know, or if we are making some stupid mistake, any help pointing us in the right direction would be much appreciated.

Thanks and Best Regards,
M.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net