0

我在通过 GFLAGS 和 UMDH 发现内存泄漏方面取得了巨大成功。但是,我刚刚发现 UMDH 不知何故在 64 位应用程序中看不到 BSTR-Leaks。有谁知道这是为什么?这是 UMDH 中的错误吗?堆管理器如何为 x64 应用程序工作的变化?我什至可以在哪里向 Microsoft 报告此类问题?

我用一个像这样的小型测试可执行文件调查了这个问题:

int main()
{
    while (true)
    {
        BSTR sLeak = CComBSTR("I am a leaky BSTR. Please find me!").Detach();
        Sleep(16);
    }

    return 0;
}

这是 x86 测试可执行文件的 UMDH 输出。泄漏是可见的!

+ 2878464 ( 3597312 - 718848)   2342 allocs BackTrace53973BC
+    1874 (   2342 -    468)    BackTrace53973BC    allocations

    ntdll!RtlWalkHeap+194
    ntdll!RtlAllocateHeap+10DC
    ntdll!RtlAllocateHeap+3E
    combase!PropVariantCopy+456
    OLEAUT32!SysAllocString+10F
    OLEAUT32!SysAllocStringLen+40
    LeakTestCom!main+48 (d:\...\leaktestcom\leaktestcom.cpp, 78)
    LeakTestCom!__scrt_common_main_seh+FA (d:\agent\_work\3\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, 288)
    KERNEL32!BaseThreadInitThunk+19
    ntdll!RtlGetAppContainerNamedObjectPath+11E
    ntdll!RtlGetAppContainerNamedObjectPath+EE

-     288 (      0 -    288)      0 allocs  BackTrace26DADAC
-       3 (      0 -      3)    BackTrace26DADAC    allocations

    ntdll!RtlWalkHeap+194
    ntdll!RtlAllocateHeap+10DC
    ntdll!RtlAllocateHeap+3E
    ntdll!TpSetWaitEx+552
    ntdll!TpCallbackIndependent+208
    KERNEL32!BaseThreadInitThunk+19
    ntdll!RtlGetAppContainerNamedObjectPath+11E
    ntdll!RtlGetAppContainerNamedObjectPath+EE

-    1380 (      0 -   1380)      0 allocs  BackTrace26DAE00
-       3 (      0 -      3)    BackTrace26DAE00    allocations

    ntdll!RtlWalkHeap+194
    ntdll!RtlAllocateHeap+10DC
    ntdll!RtlAllocateHeap+3E
    ntdll!TpCallbackIndependent+7F0
    KERNEL32!BaseThreadInitThunk+19
    ntdll!RtlGetAppContainerNamedObjectPath+11E
    ntdll!RtlGetAppContainerNamedObjectPath+EE


Total increase == 2876796 requested + 134772 overhead = 3011568

这是 x64 测试可执行文件的 UMDH 输出。如您所见,BSTR 分配不可见。

-     136 (      0 -    136)      0 allocs  BackTraceD670D5C4
-       1 (      0 -      1)    BackTraceD670D5C4   allocations

    ntdll!RtlAllocateHeap+AFD
    ntdll!TpReleaseCleanupGroupMembers+1D51
    ntdll!TpReleaseCleanupGroupMembers+4F0
    KERNEL32!BaseThreadInitThunk+14
    ntdll!RtlUserThreadStart+21

-    2736 (      0 -   2736)      0 allocs  BackTraceD670DA44
-       3 (      0 -      3)    BackTraceD670DA44   allocations

    ntdll!RtlAllocateHeap+AFD
    ntdll!TpReleaseCleanupGroupMembers+B5C
    KERNEL32!BaseThreadInitThunk+14
    ntdll!RtlUserThreadStart+21


Total decrease ==   2872 requested +    200 overhead =   3072
4

0 回答 0