在无限循环中发送数据时出现OutOfMemory异常

时间:2013-12-19 13:20:22

标签: vb.net exception out-of-memory infinite-loop

我试图通过无限循环发送数据来测试服务器,但过了一段时间我从我这边有一个OutOfMemoryException。 我试图找出这个例外的来源。 以下代码是否会导致此异常,或者我必须在其他地方检查?

Dim myArray(49) As String
For count As Integer = 0 To myArray.Length - 1
   myArray(count) = "T"
Next    
Do
   Try
      Dim sMystruct As New Mystruct()
      sMystruct.mystring1 = "test"
      sMystruct.mystring2 = "test"
      sMystruct.value1 = 128
      sMystruct.value2 = 128
      sMystruct.misc = myArray

      myInstance.sendData(sMystruct)
      sMystruct = Nothing
   Catch e As Exception
       Console.WriteLine(e.ToString())
       Console.Write(e.StackTrace)
   End Try
Loop Until False

由于

0 个答案:

没有答案