下面的代码是否需要做一些事情来释放它使用的内存?
Dim objImage As MemoryStream
Dim objwebClient As WebClient
Dim sURL As String = Trim(m_StationInterface.PicLocation)
objwebClient = New WebClient
objImage = New MemoryStream(objwebClient.DownloadData(sURL))
m_imgLiftingEye.Image = Image.FromStream(objImage)
该代码位于一个不应被丢弃的弹出表单上。每次弹出时都会将新图像加载到表单上。但是,每次通过该代码块时,应用程序的进程大小都会继续增长。
我试过 objImage.Close() 和 .Flush(),objWebClient.Dispose()。每次调用后,进程大小仍会增长 4mb。就像旧图像被保存在记忆中一样。