Hi Jeffrey,
--- Jeffrey Chang <jef...@gm...> wrote:
> I'm using asio::deadline_timer to implement a dedicate timer
> thread. It works ok, except for a memory leak problem
> (reported by Valgrind) when demuxer::post() is called after
> demuxer::run() returns.
As of 0.3.6, it is the application's responsibility to call
demuxer::run() until there is no work left to do. Since your app
is not calling demuxer::run() after calling demuxer::post(), it
is not fulfilling that responsibility, hence the leak.
For convenience, I'm looking at cleaning up undelivered handlers
in the demuxer's destructor, but that's for a future version.
For now, to implement a clean shutdown you should cancel all
timers and wait for the demuxer::run() call to return normally.
It will return once all handlers have been delivered.
Cheers,
Chris
|