Skip to content

Commit ce39368

Browse files
Force GC in this test
We use Timers for heartbeats (again) and it seems that Timer#Dispose does not release its underlying native timer (handle), that only happens after the timer is collected. Fixes #102.
1 parent 018ca41 commit ce39368

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

projects/client/Unit/src/unit/TestConnectionChurnHandleLeak.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ protected void PerformLeakTest(ConnectionFactory cf)
8080
{
8181
}
8282
}
83+
GC.Collect();
84+
GC.WaitForPendingFinalizers();
8385
Thread.Sleep(TimeSpan.FromSeconds(10));
8486
Console.WriteLine("{0} handles after the test...", me.HandleCount);
8587
Assert.That(me.HandleCount, Is.LessThanOrEqualTo(n));

0 commit comments

Comments
 (0)