Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
D3DXMATRIX ColladaFileLoader::processMatrix(daeElement* node)
D3DXMATRIX matWorld;

daeTArray<daeElementRef> nodeChildren = node->getChildren();

for (int i = 0; i < nodeChildren.getCount(); i++)
    string type = nodeChildren[i]->getAttribute("sid");

    if (type == "rotationX")
        string data = nodeChildren[i]->getCharData();
        stringstream stm(data);

        stm >> matWorld.m[0][0];
        stm >> matWorld.m[0][1];
        stm >> matWorld.m[0][2];
        stm >> matWorld.m[0][3];

    if (type == "rotationY")
        string data = nodeChildren[i]->getCharData();
        stringstream stm(data);

        stm >> matWorld.m[1][0];
        stm >> matWorld.m[1][1];
        stm >> matWorld.m[1][2];
        stm >> matWorld.m[1][3];

    if (type == "rotationZ")
        string data = nodeChildren[i]->getCharData();
        stringstream stm(data);

        stm >> matWorld.m[2][0];
        stm >> matWorld.m[2][1];
        stm >> matWorld.m[2][2];
        stm >> matWorld.m[2][3];

    if (type == "location")
        string data = nodeChildren[i]->getCharData();
        stringstream stm(data);

        stm >> matWorld.m[3][0];
        stm >> matWorld.m[3][1];
        stm >> matWorld.m[3][2];
        matWorld.m[3][3] = 1;


return matWorld;

This function will run run debug assertion failed after it ends the first pass through the loop. The loop will run correctly, it will enter the last if statement and set all values correctly. However when the pass is done and before it starts the next pass it will debug assertion failed on me. I think it is trying to destroy the string type variable but something is breaking when it does tries to delete it. I don't know what the problem is. It seems to do this on other parts of my program that get strings from the file and place in std::string. I fixed those by just removing those entirely but this one cannot be removed it needs to exist.

Don't know if this has anything to do with it, but I'm using visual studio 11 dev preview, and using compiler vs100 (vs10's compiler) settings.

dbgheap.c Line:1322

Expression: _CrtISValidHeapPointer(pUserData)

also when i use debugger none of my vars from this function show up after the error.

share|improve this question
You seem to have a pretty fundamental, serious problem managing your memory. Your comment about "removing" code to "fix" a problem is telling: you're unlikely to actually be fixing anything, just moving your problem around. You're probably operating on corrupted memory by the time the code you've posted executes, the actual problem is likely entirely elsewhere in your program. In short, I'm not sure there is enough information here to accurately answer you and I'm not sure this site is the best place to get help. Perhaps you could discuss the issue in chat? – Josh Petrie Oct 20 '11 at 15:18
Yea removing those isn't a real fix at all. How would I go about tracking this bug down? I don't know how or where to start looking. – EddieV223 Oct 20 '11 at 18:44
The only time I see this problem is when I use strings and that particular function call, what does that tell us that it could be? – EddieV223 Oct 20 '11 at 18:47
Is this function within a DLL you've created? – Vite Falcon Oct 20 '11 at 19:19
You are corrupting your heap, you are writing a value into a variable past it's heap buffer and you are ruining your whole programs heap, that's why you cant see the variables in the debugger. – Matt Jensen Oct 20 '11 at 23:46

You can use assert(_CrtCheckMemory()); to check the whole heap for corruption.

By adding lots of those tests you should be able to narrow down the line of code that causes the corruption.

share|improve this answer

Is node null (or otherwise invalid)?

Are you sure getCharData doesn't modify the object it's called on?

share|improve this answer
+1 before putting memory asserts everywhere, make sure you do all the basic checks for null – Jonathan Connell Oct 21 '11 at 11:44
The passed in node is never null, and the call to node->getChildren() also works fine. In fact the function runs fine as I watch in the debugger line for line until it reaches the end of the first loop and then bang error. – EddieV223 Oct 24 '11 at 17:52
It may not be null, but it may not be a valid pointer either. It's much more likely that the bug is in your own code than in colladaDOM.dll, so you might want to post some of the surrounding code that you're using to call this stuff. – Kylotan Oct 24 '11 at 18:25
up vote 0 down vote accepted

Ok found the problem after nearly a week of beating my head against the wall, for others who may have run into this issue in the future I'll post the solution.

The version of colladaDOM I used was compiled with /mDd library (multi-threaded debug dll) while my project was using /mtd (multi threaded debug static) settings. After changing my project to /MDd all my problems vanished.

Another possible solution would be to rebuild DOM with /mtd to match the project settings.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.