In a .net windows application the form might have resource leaks though it is running with managed codes. We can use the below procedure to check if a form is having resource leak.
|
Test 1
|
// Test 1: // Explicit Calling Dispose CheckForm ChkFrm = new CheckForm(); ChkFrm.ShowDialog(); ChkFrm.Dispose(); // Force garbage collection. GC.Collect();
Test 2 :
// Test 2: // Implicit calling to Dispose // Dispose will be called immediately after the using // block, when the form goes out of scope. using (CheckForm ChkFrm = new CheckForm()) { ChkFrm.ShowDialog(); } // Force garbage collection. GC.Collect();