This topic is now archived and is closed to further replies.


Help needed on Curious 'HeapValidate' error

Recommended Posts

I have a piece of code that wraps expat (an XML parser) to help me collect the attributes and configure the objects involved. However at one point in my code I get a very unexpected error. I have ben probing around for 2 days trying to work it out but it makes no sense to me. The MS debug code traps an error on this line(heapchk.c) if (!HeapValidate(_crtheap, 0, NULL)) the last line of my code to execute is
CXMLObject* Object = CFactory<std::string, CXMLObject>::GetInstance().Create(a_Element);
if (Object == 0)

CKeypair Pairs; //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<There

for (int i = 0; a_Attributes[i]; i += 2) 
	Pairs.Insert(std::string(a_Attributes[i]), std::string(a_Attributes[i + 1]));
Now, you''d probably ask, whats that Keypair class doing in it''s constructor maybe? Well I didn''t define one. The only thing the class does I guess is initialise it''s only member variable. std::map m_Pairs; I have plenty of ram, so what would this not be working? All thoughts\idea''s appreciated. Many thanks Chris Brodie http:\\

Share this post

Link to post
Share on other sites
Is it possible that this call :

CXMLObject* Object = CFactory::GetInstance().Create(a_Element);

Is corrupting the heap, and the compiler only notice on its next heap check, which happens to be on memory allocation for your CKeyPairs object?


Share this post

Link to post
Share on other sites