我有一个用 VB.Net 编写的大型复杂 Windows 窗体应用程序。用户遇到了一些内存问题,并使用 JetBrains dotTrace Profiler 尝试清除其中的一些问题。
仍然有什么东西把我的一些物品打开了。我有一个“客户”对象,它有一个Generic.List
. InvoiceLineItem
该项目基本上是一个绑定到网格控件(ConponentOne FlexGrid)的对象,该控件具有用于显示数据的只读属性的负载,例如:
Public Class InvoiceLineItem
Private _customer as Customer
Private _charge as Charge
Sub New(Customer as Customer, Charge as Charge)
_customer = Customer
_charge = Charge
End Sub
Public ReadOnly Property Name as String
Return _customer.Name
End Property
Public ReadOnly Property ItemName as String
Return _charge.Name
End Property
Public ReadOnly Property Amount as Decimal
Return _charge.Amount
End Property
End Class
等等
这个对象看起来好像没有从 FlexGrid 中释放。
Flexgrid 在子窗体上,从主窗体显示。当子窗体关闭时,Memory Profiler 显示该窗体仍被引用。当我单击 dotTrace 中的“最短路径”时,显示以下路径。
这似乎是 Customer 中唯一具有根路径的对象。
我的对象或集合之间没有以这种形式进行的自定义事件处理,并且没有任何处理。
我应该怎么做才能进一步解决这个问题?