dfleury2 / beauty

A Simple C++ Http server/client above Boost.Beast
MIT License
184 stars 21 forks source link

Possible Memory Leak On beauty::application destructor #27

Open ceyert opened 10 months ago

ceyert commented 10 months ago

Hi, Due to investigation,

application::~application()
{
    stop(false);  //  memory leak possibility which not stop timers
}

but timers are not destructing :

void
application::stop(bool reset)
{
...
    if (reset) {
        for(auto&& t : timers) {
            t->stop();
        }
        timers.clear();
    }
...
}

In timer.hpp, _timer member uses _app.ioc() but seems like ioc is stopped on application destruction.

My question is why destruction of application set reset false?

dfleury2 commented 9 months ago

Hi, I am not sure I remember well but, I got some issue when I stopped and restart the application (unusual use). It should not leak, The application should live until the main exit.

Do you have a valgrind report that show a leak ?