如何检查dbexpress组件是否存在内存泄漏?
在一个非常简单的示例VCL项目中(1格式,1格,1简单数据集),我使用dbexpress Data.DBXMSSQL
从Micorosft SQL Server的随机表中请求数据。 我使用ReportMemoryLeaksOnShutdown := true;
启用了内存泄漏报告ReportMemoryLeaksOnShutdown := true;
只要读取数据并进行本地编辑,就不会报告内存泄漏。 如果我使用更改发布到服务器
SimpleDataSet1.ApplyUpdates(0);
程序结束后我收到以下消息:
如果我启用 FastMM4 FullDebugmode,则不报告内存泄漏。 在delphi 10重新编译内存泄漏时是否存在缺陷,或者是否有内存泄漏,我不得不担心?
示例单位:
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, Datasnap.DBClient, SimpleDS,
Vcl.Grids, Vcl.DBGrids, Data.SqlExpr, Data.DBXMSSQL;
type
TForm1 = class(TForm)
SQLConnection1: TSQLConnection;
DBGrid1: TDBGrid;
DataSource1: TDataSource;
SimpleDataSet1: TSimpleDataSet;
procedure SimpleDataSet1AfterPost(DataSet: TDataSet);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.SimpleDataSet1AfterPost(DataSet: TDataSet);
begin
SimpleDataSet1.ApplyUpdates(0);
end;
表格定义(简化):
object Form1: TForm1
object DBGrid1: TDBGrid
DataSource = DataSource1
end
object SQLConnection1: TSQLConnection
ConnectionName = 'XXXXXXXX'
DriverName = 'MSSQL'
LoadParamsOnConnect = True
LoginPrompt = False
Params.Strings = (
'BlobSize=-1'
'DataBase=XXXXXXXX'
'DriverName=MSSQL'
'ErrorResourceFile='
'HostName=XXXXXXXX'
'IsolationLevel=ReadCommitted'
'LocaleCode=0000'
'OS Authentication=False'
'Password=XXXXXXXX'
'Prepare SQL=False'
'SchemaOverride=%.dbo'
'User_Name=XXXXXXXX')
Connected = True
end
object DataSource1: TDataSource
DataSet = SimpleDataSet1
end
object SimpleDataSet1: TSimpleDataSet
Active = True
Aggregates = <>
Connection = SQLConnection1
DataSet.CommandText = 'SELECT * FROM XXXXXXXX'
DataSet.MaxBlobSize = -1
DataSet.Params = <>
Params = <>
AfterPost = SimpleDataSet1AfterPost
end
end
链接地址: http://www.djcxy.com/p/18387.html
上一篇: How can I check if a memory leak exists the dbexpress components?
下一篇: Python memory leaks