Ian*_*dby 10 delphi fastmm access-violation
我正在尝试追踪访问冲突.再现性似乎是非确定性的,并且很少见,因此我想在进一步研究之前检查一些我的假设.
在以下代码中,在函数DebugGetMem中的FaseMM4版本4.991中引发了访问冲突:
if (ASize > (MaximumMediumBlockSize - BlockHeaderSize - FullDebugBlockOverhead))
or CheckFreeBlockUnmodified(Result, GetAvailableSpaceInBlock(Result) + BlockHeaderSize, boGetMem) then
begin
{Set the allocation call stack}
GetStackTrace(@PFullDebugBlockHeader(Result).AllocationStackTrace, StackTraceDepth, 1);
{Set the thread ID of the thread that allocated the block}
PFullDebugBlockHeader(Result).AllocatedByThread := GetThreadID; // ** AV Here
{Block is now in use: It was allocated by this routine}
PFullDebugBlockHeader(Result).AllocatedByRoutine := @DebugGetMem;
Run Code Online (Sandbox Code Playgroud)
例外是:
if (ASize > (MaximumMediumBlockSize - BlockHeaderSize - FullDebugBlockOverhead))
or CheckFreeBlockUnmodified(Result, GetAvailableSpaceInBlock(Result) + BlockHeaderSize, boGetMem) then
begin
{Set the allocation call stack}
GetStackTrace(@PFullDebugBlockHeader(Result).AllocationStackTrace, StackTraceDepth, 1);
{Set the thread ID of the thread that allocated the block}
PFullDebugBlockHeader(Result).AllocatedByThread := GetThreadID; // ** AV Here
{Block is now in use: It was allocated by this routine}
PFullDebugBlockHeader(Result).AllocatedByRoutine := @DebugGetMem;
Run Code Online (Sandbox Code Playgroud)
调用堆栈通常是相同的.它是从虚拟树视图上的paint事件中调用的,DebugGetMem虽然我怀疑它是否真正相关(除了Format分配动态内存).
我正在使用Format('%s %s %s', [vid, node, GetName()])(显然)和FullDebugMode选项.
我还建立了以下内容:
CheckHeapForCorruption并没有显示任何新内容.我仍然得到相同的访问冲突,没有其他诊断.CatchUseOfFreedInterfaces,虽然我不记得FullDebugModeScanMemoryPoolBeforeEveryOperation := True在这个场合是打开还是关闭.我是否正确地认为,尽管CatchUseOfFreedInterfaces没有捕获任何东西,但这个异常只能归因于我的代码破坏了堆?还有什么可能导致FastMM4以这种方式崩溃吗?
有关进一步诊断的建议,甚至使崩溃更可重复吗?
| 归档时间: |
|
| 查看次数: |
1051 次 |
| 最近记录: |