私はこの小さなコードを持っていますが、特定の時点で GC がメモリを消去すると予想していましたが、代わりにメモリが不足していました。
これは GC の正しい動作ですか?
Private Sub Form1_Load()
Dim WasterWrapper as cMyClass
For MapIndex = 1 To 50
WasterWrapper = New cMyClass
Next
End Sub
これはメモリを割り当てるクラスです
Public Class cMyClass
Private mArry(,) As Double
Sub New()
Dim i As Integer
Dim j As Integer
ReDim mArry(5000, 5000)
For i = 0 To 5000
For j = 0 To 5000
mArry(i, j) = Rnd() * 1000
Next
Next
End Sub
Protected Overrides Sub Finalize()
MsgBox("Finalising the wrapper")
MyBase.Finalize()
End Sub
End Class