TJvMemoryData.InternalSetFieldData 中的偶发访问冲突 [英] Sporadic Access Violation in TJvMemoryData.InternalSetFieldData

查看:19
本文介绍了TJvMemoryData.InternalSetFieldData 中的偶发访问冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试解决此代码中发生的 Delphi XE7 应用程序中的访问冲突,该代码是 Jedi VCL JvMemoryDataset 组件的一部分(当前 source 在 Github):

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;

该代码偶尔导致地址 04020111 处的读取访问冲突.此代码中是否存在明显问题?(CalcFieldLen 可能返回 0,不确定这里是否相关).

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).

我已经检查了 JVCL 的当前开发版本,并且 Move 调用与我的(旧的)本地版本中的相同.

I have checked the current development version of JVCL and the Move call is the same as in my (older) local version.

它可能与问题有关 https://issuetracker.delphi-jedi.org/view.php?id=6276

相关(带有调试建议):从D2006移植到XE5后偶尔出现访问冲突,XP兼容模式下不会发生

Related (with debugging suggestions): Sporadic Access Violation after porting from D2006 to XE5, doesn't happen in XP compatibility mode

推荐答案

切换FetchOptions.Unidirectional 属性 FireDAC 查询为 True.(属性默认值为False)

The access violation disappeared after switching the FetchOptions.Unidirectional property of the FireDAC query to True. (The property default value is False)

我猜这个访问冲突是由低内存情况下的内存损坏引起的.FireDAC 查询已关闭并重新打开(翻阅大型数据集),因此在加载的数据量很高时会发生这种情况.

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.

这篇关于TJvMemoryData.InternalSetFieldData 中的偶发访问冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆