【发布时间】:2014-08-26 08:39:19
【问题描述】:
我有一个 MyClass 类,它在构造函数 (DI) 中有一个 MyThreadPool 类型的参数。
MyThreadPool 是一个单例。代码如下:
Public Class MyClass
Private _threadPool as MyThreadPool
Public Sub New(threadPool as MyThreadPool)
_threadPool = threadPool
End Sub
End Class
在 MyClass 的私有字段 (_threadPool) 中保存单例 MyThreadPool 是否会导致 MyClass 的任何实例留在内存中并且变得不可被 GC 收集?
【问题讨论】:
标签: .net vb.net memory-leaks singleton