Reputation: 36664
I am trying to resolve an access violation in a Delphi XE7 application which is occurs in this code, which is part of the Jedi VCL JvMemoryDataset component (current source at Github):
begin
Data^ := Ord(Buffer <> nil);
Inc(Data);
if Buffer <> nil then
Move(Buffer^, Data^, CalcFieldLen(Field.DataType, Field.Size)) <---------- AV here
else
FillChar(Data^, CalcFieldLen(Field.DataType, Field.Size), 0);
end;
The code sporadically causes a read access violation at address 04020111. Is there an obvious problem in this code? (CalcFieldLen might return 0, not sure if this is relevant here).
I have checked the current development version of JVCL and the Move call is the same as in my (older) local version.
It might be related to the issue https://issuetracker.delphi-jedi.org/view.php?id=6276
Related (with debugging suggestions): Sporadic Access Violation after porting from D2006 to XE5, doesn't happen in XP compatibility mode
Upvotes: 1
Views: 231
Reputation: 36664
The access violation disappeared after switching the FetchOptions.Unidirectional property of the FireDAC query to True. (The property default value is False)
I guess this access violation was caused by memory corruption in low-memory situations. The FireDAC query was closed and re-opened (paging through a large dataset) so it happened when the amount of loaded data was high.
Upvotes: 0