Disposal of forms

  • Thread starter Thread starter booboo_US
  • Start date Start date
B

booboo_US

Guest
Hi Everyone:

I am using vb.net 2019 and I have a follow-up question to my previous post. In my application, I have many forms. Can anyone explain why when I dispose of a form, it still hangs on to a bit of memory even though I have disposed the form? I used the VB.NET diagnostic tools to see the amount of memory used. Thanks;

Bob

Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Form2.Show()
End Sub
End Class


Public Class Form2
Public inp(10000, 10000) As Double

Private Sub Form2_Closed(sender As Object, e As EventArgs) Handles Me.Closed
inp = Nothing
Me.Dispose()
'GC.SuppressFinalize(Me) 'And Also Added These Command To Remove
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.Close()
End Sub
End Class

Continue reading...
 
Back
Top