function TFormMain.GetMyTBytes(const AFileName: string): TBytes;
begin
with TFileStream.Create(AFileName, fmOpenRead or fmShareDenyNone) do
try
SetLength(Result, Size);
ReadBuffer(PByte(Result)^, Size);
finally
Free;
end;
end;
// ...
var
TBA, TBB: TBytes;
// ...
TBA := GetMyTBytes('C:\mydoc.docx');
TBB := Copy(TBA);
Can it be excluded in this case that TBB
shares any memory with TBA
at the end of this operation?