English 中文(简体)
Hunting memory leaks
原标题:

I m finding leaked heap blocks by using the following command in WinDbg

!heap –l

With each leaked heap block I get, I m running to following to get the stack trace.

!heap -p -a leakedheapblock

The following is the result of this command:

address 1c841cc0 found in
_HEAP @ 3930000
  HEAP_ENTRY Size Prev Flags    UserPtr UserSize - state
    1c851cc0 0009 0000  [03]   1c851ce8    0000c - (busy)
    Trace: 84f8
    7c873c19 ntdll!RtlpDphNormalHeapAllocate+0x00000030
    7c876870 ntdll!RtlpDebugPageHeapAllocate+0x00000335
    7c8794a8 ntdll!RtlDebugAllocateHeap+0x0000002d
    7c8531e4 ntdll!RtlAllocateHeapSlowly+0x00000041
    7c83d97a ntdll!RtlAllocateHeap+0x00000e9f
    1699d238 MyLibrary!malloc+0x0000007a

How can I find the piece of code in MyLibrary that leaks.

问题回答

There is a nice guide about this in MSDN: Memory Leak Detection Enabling





相关问题
How can i add a button to all windows explorer instances?

I am trying to add a button to one of the existing tool bars in any windows explorer instance. After much research i figured out that BHO (browser helper objects) are the best way to hook to ...

Hunting memory leaks

I m finding leaked heap blocks by using the following command in WinDbg !heap –l With each leaked heap block I get, I m running to following to get the stack trace. !heap -p -a leakedheapblock The ...

Why use CComBSTR instead of just passing a WCHAR*?

I m new to COM. What exactly is the advantage of replacing: L"String" with CComBSTR(L"String") I can see a changelist in the COM part of my .NET application where all strings are replaced in this ...

IThumbnailProvider and IInitializeWithItem

I am trying to develop an IThumbnailProvider for use in Windows 7. Since this particular thumbnail would also be dependant on some other files in the same directory, I need to use something other than ...

Getting a byte array from out of process C++ COM to C#

What s the best way to get a chunk of memory (i.e. void*) from a COM server to C#? We have been using an IStream (using CreateStreamOnHGlobal) and passing that back, which worked. However when we ...

COM Basic links

folks can you provide me the tutorial link or .pdf for learning basic COM?. i do google it.. still i recommend answers of stackoverflow so please pass me.. Thanks

热门标签