2013-03-29 27 views
-1

我有一個用VB.Net編寫的大型複雜Windows窗體應用程序。用戶遇到一些內存問題,並使用JetBrains dotTrace Profiler嘗試清除其中的一些內容。VB.Net應用程序中的內存泄漏,由網格保持打開的對象?

仍然有東西把我的一些物品打開。我有一個'客戶'對象,其中有一個Generic.ListInvoiceLineItem。此產品是基本上結合到電網控制(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在子窗體上顯示,從主窗體中顯示。當子窗體關閉時,內存分析器顯示窗體仍然被引用。當我點擊dotTrace中的「最短路徑」時,顯示下面的路徑。

Shortest Path

這似乎是在顧客的唯一對象與根路徑。

在我的對象或集合之間沒有自定義事件處理在這種形式下進行,並且沒有任何處理。

我應該怎麼做才能進一步排除故障?

回答

0

我發現了這個問題。 FormClosing事件正在其他地方進行處理,並針對未保存的數據進行測試,表單引用正在被保留在該函數中,而未被髮布!