我在Delphi 7应用程序中有这个功能,在我将FastMM4 v4.99包含在项目中之前一直运行良好.一旦包含,FastMM4引发了以下错误消息:"FastMM在FreeMem操作期间检测到错误.块页脚已损坏." 执行在FreeMem行中停止.
function BinaryFieldToArrayOfWord( aBinaryField : TVarBytesField;
out aArrValues : TArrWord ) : Boolean;
var
p : Pointer;
begin
if not aBinaryField.IsBlob then
begin
GetMem( p, aBinaryField.DataSize );
try
if aBinaryField.GetData( p ) then
begin
// do something
end;
finally
FreeMem( p, aBinaryField.DataSize );
end;
end; // if
end;
Run Code Online (Sandbox Code Playgroud)
首先我认为函数中必定存在错误,但它实际上与Delphi 7帮助中的TField.GetData方法示例相同:
{ Retrieve the "raw" data from Field1 }
with Field1 do
begin
if not IsBlob { this does not work for BLOB fields }
begin
{ Allocate …Run Code Online (Sandbox Code Playgroud)