![](/img/trans.png)
[英]How do I get access to FastMM4's RegisterExpectedMemoryLeak?
[英]Occasional access violation in FastMM4, DebugGetMem
我正在嘗試追蹤訪問沖突。 再現性似乎是非確定性的,並且很少見,因此我想在進一步研究之前檢查一些我的假設。
在函數DebugGetMem
中的FastMM4版本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;
例外是:
Project Workstation.exe引發異常類$ C0000005,消息“訪問沖突位於0x01629099:讀取地址0x66aed8f8”。
調用堆棧通常是相同的。 它是從虛擬樹視圖上的繪制事件中調用的,我稱之為Format('%s %s %s', [vid, node, GetName()])
雖然我懷疑它是否真的相關(除了格式分配動態)記憶)。
我正在使用FullDebugMode
(顯然)和CheckHeapForCorruption
選項。
我還建立了以下內容:
CatchUseOfFreedInterfaces
不會顯示任何新內容。 我仍然得到相同的訪問沖突,沒有其他診斷。 FullDebugModeScanMemoryPoolBeforeEveryOperation := True
重現了崩潰,雖然我不記得CatchUseOfFreedInterfaces
是否在此時開啟或關閉。 我是否正確地認為,盡管CheckHeapForCorruption
沒有捕獲任何東西,但這個異常只能是因為我的代碼破壞了堆? 還有什么可能導致FastMM4以這種方式崩潰嗎?
有關進一步診斷的建議,甚至使崩潰更可重復嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.