_CrtIsValidHeapPointer throwing an exception

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
 
  I have a mixed (native/cls) WinForms app that calls into a native DLL and consistantly throws a _CrtIsValidHeapPointer exception.
  As best I can tell, it occurs when the DLL initalizes. According to the stack, when this guy gets initalized, everything blows up. <font color="#0000ff" size=2>
static</font><font size=2> std::locale g_loc; </font><font color="#008000" size=2>// default locale</font>
<font color="#008000" size=2>From there we wind through a couple of function calls, and end up at</font> <font color="#008000" size=2><font color="#008000" size=2>
/*
* If this ASSERT fails, a bad pointer has been passed in. It may be
* totally bogus, or it may have been allocated from another heap.
* The pointer MUST come from the local heap.
*/ </font><font size=2>
_ASSERTE(_CrtIsValidHeapPointer(pUserData));
 
<font color="#000000 My guess is that its blowing up because the pointers being passed from a heap other than the "local" heap. Unfortunately, I have no clue how to fix it because it happens before my code executes. Any ideas?</font> </font></font>

View the full article
 
Back
Top