Sub Main()
Console.WriteLine("Allocated memory " & GC.GetTotalMemory(True))
Dim c1 As New Contact("Name 1", "111-555-1111", "[email protected]") Dim c2 As New Contact("Name 2", "222-555-1212", "[email protected]") Dim c3 As New Contact("Name 3", "333-555-1212", "[email protected]")
c1 = Nothing ' Discard the object
GC.Collect()
Console.WriteLine("Back from first collection")
c3 = Nothing ' Discard the object
GC.Collect()
Console.WriteLine("Back from second collection -- Press Enter")