This is my entire test project. One form, one DataGridView and three buttons:
I have also tried binding to a list of Integers in case something odd was occurring with my custom class.
vb Code:
Private myList As BindingList(Of TrackedSet) Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) If (myList Is Nothing) Then myList = New BindingList(Of TrackedSet) End If ' Binding here needs two GC's to reclaim memory when unbinding ' dgv.DataSource = myList Dim i As Integer For i = 0 To 50000 myList.Add(New TrackedSet(i, "00000000001,123,abc")) Next i ' Binding here allows memory to be reclaimed ok when unbinding dgv.DataSource = myList End Sub Private Sub button2_Click(ByVal sender As Object, ByVal e As EventArgs) dgv.DataSource = Nothing myList.Clear myList = Nothing End Sub Private Sub button3_Click(ByVal sender As Object, ByVal e As EventArgs) GC.Collect End Sub





Reply With Quote
