Windows error 0x000000D7, 215

Detailed Error Information


MessageCannot nest calls to LoadModule.
Declared inwinerror.h

This appears to be a raw Win32 error. More information may be available in error 0x800700D7.


This is a Blue Screen of Death stop code. More information is available in the Knowledge Base article Bug Check 0xD7: DRIVER_UNMAPPING_INVALID_VIEW.

HRESULT analysis[3]

This is probably not the correct interpretation of this error. The Win32 error above is more likely to indicate the actual problem.

This code indicates success, rather than an error. This may not be the correct interpretation of this code, or possibly the program is handling errors incorrectly.

Reserved (R)false
Reserved (X)false
FacilityCode0 (0x000)
DescriptionThe default facility code.[3][1]
Error Code215 (0x00d7)

Possible solutions


Passing unmanaged array to a Managed Thread. - memory corruption

dt = new int(sz);

This is allocating a single integer, (not an array), and initializing it with the value of sz (100). What you want is this:

dt = new int[sz];

This allocates an array of size dt. Note that in order to avoid leaking memory, you must later free it like this:

delete [] dt;
answered on Stack Overflow Nov 27, 2010 by Adam Rosenfield

Page Heap doesn't record useful stack infomation?


Thanks to @Marc Sherman for pointing out in the comments that I should check out the real allocation stack trace.

As already edited into the question, VC80(VS2005) is the problem here, as it's CRT has FPO enabled, as seen in the stack trace:

MSVCR80!malloc+0x7a (FPO: [1,0,0]) (CONV: cdecl) 
MFC80U!operator new+0x2f (FPO: [Uses EBP] [1,0,0]) (CONV: cdecl)

Now, having an anchor to search, we find the following:

Why does every heap trace in UMDH get stuck at “malloc”?

Adding a few quotes:

In particular, it would appear that the default malloc implementation on the static link CRT on Visual C++ 2005 not only doesn’t use a frame pointer, but it trashes ebp as a scratch register ...

What does this all mean? Well, anything using malloc that’s built with Visual C++ 2005 won’t be diagnosable with UMDH or anything else that relies on ebp-based stack traces, at least not on x86 builds.

There is also a reply in the comments that's got nice info:

Mark Roberts [MSFT] says: February 25, 2008 at 3:03 pm


Enabling FPO for the 8.0 CRT was not deliberate. The Visual Studio 2008 CRT (9.0) does NOT have FPO enabled, and UMDH should function normally.

For 8.0, an alternative to UMDH would be to use LeakDiag. LeakDiag will actually instrument memory allocators to obtain stack traces. This makes it more versatile than UMDH as it can hook several different allocator types at different granularities (Ranging from the c runtime to raw virtual memory allocations).

By default, LeakDiag simply walks the stack base pointers, but it can be modified to use the Dbghlp StackWalkAPI to resolve FPO data. This will produce full stacks, though the performance penalty is higher. On the flip side, you can customize the stack walking behavior to only go to a certain depth, etc to minimize the perf penalty.

Please find LeakDiag here:

answered on Stack Overflow Sep 27, 2013 by Martin Ba • edited Sep 27, 2013 by EdChum

Memory leak due to marshalling managed delegate?


Just declare your native method with a delegate parameter instead of IntPtr. The marshaler will do all this stuff for you.

answered on Stack Overflow Sep 13, 2012 by Anton Tykhyy

Windows Phone App crashes after Launcher.LaunchFileAsync when downloaded from store


Looks like you failed to use LaunchFileAsync/FileOpenPicker correctly. Follow this guide carefully.

Unless debugging, OS terminates your process just after you've called the picker (especially on low-memory devices with 512MB RAM). It's up to your application to save its state, and when reactivated restore the state and take user to the exact place in your app where she was.

Also, here’s how you can debug the problem.

answered on Stack Overflow May 29, 2015 by Soonts • edited May 23, 2017 by Community

How to diagnose a corrupted suffix pattern in a mixed managed/unmanaged x32 .NET application


I finally resolved this, and found that I had made one crucial mistake. With a corrupted suffix pattern, the error will come on a free attempt, which led me to believe that it was unlikely that the allocation would have come right before the free. This was not accurate. When dealing with corruption that occurs on free, barring further information, any allocation point is equally likely. In this case, the verifier halt was coming on freeing a parameter which had been incorrectly defined as a struct of shorts instead of as a struct of ints.

Here's the offending code:

    [DllImport("gdi32.dll", CharSet = CharSet.Unicode)]
    [return: MarshalAs(UnmanagedType.Bool)]
    static extern bool GetCharABCWidths(IntPtr hdc, uint uFirstChar, uint uLastChar, [Out] ABC[] lpabc);

(This declaration is okay)

    public struct ABC
        public short A;
        public ushort B;
        public short C;

(This is not okay, per the MSDN article on the ABC struct : )

So, if you find yourself debugging memory corruption that halts on free, keep in mind: never discount the possibility that the memory being freed was incorrectly allocated to begin with... and mind those [Out] parameters on unmanaged calls!

answered on Stack Overflow Feb 14, 2014 by ianschol

Memory leak due to marshalling managed delegate?


As far as I know delegate is a list of function pointers in C#. Passing that to a parameter of function pointer in C++ makes me feels there will be a problem. You should consider adding a native function to report status and pool this one in a separate thread or background worker in C#. Such that you do not need to pass a delegate any more.

answered on Stack Overflow Sep 13, 2012 by Mahmoud Fayez


Leave a comment

(plain text only)


  1. winerror.h from Windows SDK 10.0.14393.0

User contributions licensed under CC BY-SA 3.0