Sau khi nâng cấp một dự án từ năm 2007 đến Delphi Delphi 2009 tôi nhận được một rò rỉ bộ nhớ Unknown, cho đến nay tôi đã tryin để theo dõi nó xuống bằng fastMM, đây là những gì fastMM vết đống báo cáo:Làm thế nào để theo dõi rò rỉ bộ nhớ khó khăn với fastMM?
A memory block has been leaked. The size is: 20
This block was allocated by thread 0x111C, and the stack trace (return addresses)
at the time was:
40339E [System.pas][System][@GetMem][3412] 534873 [crtl][_malloc]
56D1C4 [canex.cpp][MidasLib][DllGetDataSnapClassObject][3918]
56D316 [canex.cpp][MidasLib][DllGetDataSnapClassObject][3961]
56D5EE [canex.cpp][MidasLib][DllGetDataSnapClassObject][4085]
562D48 [DBCommon.pas][DBCommon][TFilterExpr.PutExprNode][1583]
408E46 [System.pas][System][DynArraySetLength][20464]
56D5EE [canex.cpp][MidasLib][DllGetDataSnapClassObject][4085]
408E92 [System.pas][System][@DynArraySetLength][20486]
528C1B [Forms.pas][Forms][TCustomForm.DoCreate][3260]
171A1A [GetRawStackTrace]
The block is currently used for an object of class: Unknown
The allocation number is: 302844
Và đôi khi tôi nhận được điều này:
A memory block has been leaked. The size is: 20
This block was allocated by thread 0x111C, and the stack trace (return addresses)
at the time was:
40339E [System.pas][System][@GetMem][3412]
534873 [crtl][_malloc]
56D1C4 [canex.cpp][MidasLib][DllGetDataSnapClassObject][3918]
56D316 [canex.cpp][MidasLib][DllGetDataSnapClassObject][3961]
77DC921A [RtlAnsiStringToUnicodeString]
56D5EE [canex.cpp][MidasLib][DllGetDataSnapClassObject][4085]
7726B8F5 [GetProcAddress]
7726B907 [GetProcAddress]
589B1E [ossrv.cpp][MidasLib][DllGetDataSnapClassObject][3163]
56D5EE [canex.cpp][MidasLib][DllGetDataSnapClassObject][4085]
408E92 [System.pas][System][@DynArraySetLength][20486]
The block is currently used for an object of class: Unknown
Có cách nào tốt hơn để tìm hiểu điều gì thực sự gây ra rò rỉ bộ nhớ?
Nó đang tạo ra một hoặc nhiều hơn 20 byte rò rỉ cho mọi hình thức tôi mở, điều kỳ lạ là nó bắt đầu xảy ra sau khi nâng cấp lên Delphi 2009, mà không thay đổi mã. –
Nếu đó là một số lượng hữu hạn, thì đó không phải là vấn đề, nhưng nếu người dùng có tùy chọn mở từng biểu mẫu nhiều lần và mỗi lần mở lỗ thêm 20 byte thì bạn sẽ bị rò rỉ bộ nhớ chậm nhưng có khả năng gây phiền hà . –
Với RAM 2 GB, người dùng sẽ phải mở khoảng 100 triệu biểu mẫu trong một phiên trước khi chúng hết bộ nhớ vật lý do rò rỉ này. May mắn cho bạn, RSI sẽ giới hạn số lượng bộ nhớ có thể bị rò rỉ bởi hành động của người dùng ở đây :-) –