You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling the Set() Method of an AsyncSignal Object the AsyncSignalWaiter is not correctly disposed:
publicvoidSet(){lock(_syncRoot){_isSignaled=true;
Cleanup();// If there is already a waiting task let it run.if(_waiter!=null){
_waiter.Approve();_waiter=null;// Waiter is never disposed// Since we already got a waiter the signal must be reset right now!_isSignaled=false;}}}
When I dispose the AsyncSignalWaiter after the approval inside Set() or inside the Approve() or Cancel() method of the AsyncSignalWaiter no memory leaks can be found (see screenshots).
publicvoidSet(){lock(_syncRoot){_isSignaled=true;
Cleanup();// If there is already a waiting task let it run.if(_waiter!=null){
_waiter.Approve();
_waiter.Dispose();// Dispose waiter_waiter=null;// Since we already got a waiter the signal must be reset right now!_isSignaled=false;}}}
Describe the bug
When calling the
Set()
Method of anAsyncSignal
Object theAsyncSignalWaiter
is not correctly disposed:When I dispose the
AsyncSignalWaiter
after the approval insideSet()
or inside theApprove()
orCancel()
method of theAsyncSignalWaiter
no memory leaks can be found (see screenshots).Which component is your bug related to?
To Reproduce
Steps to reproduce the behavior:
4.1.3.436
of MQTTnet or themaster
branch.Client
orManagedClient
(see code below).Expected behavior
The
CancellationTokenRegistration
inside theAsyncSignalWaiter
should always be disposed.Screenshots
Without disposing the
AsyncSignalWaiter
With disposing of the
AsyncSignalWaiter
Code example
Simple console app used for memory profiling:
The text was updated successfully, but these errors were encountered: