Game Development Community

T3D V1.1 - Heap corruption

by Keith G Wood · in Technical Issues · 05/09/2013 (4:07 am) · 3 replies

I am working on a game for a few months now. All of a sudden, I started to get crashes. Using Visual Studio in debug I determined it was a heap corruption - of course where the crash occurs is a victim, not the original cause.

I looked at what I had recently added, and have determined a particular model appears to be a catalyst - removing this & the problem seems to have gone away. So I do have a workround for this, but at the moment I don't understand what exactly is going wrong - which makes me nervous.

I know I could log heap allocations / frees - but I have to do an awful lot in the game before it shows up, and the exact point of crash appears random (even if I reproduce what I think are the exact same steps since invoking the executable) - so that would likely be a very long winded approach.

The game has multiple scenes. The crash has only ever occured in the scene with the most models. The crash only occurs after multiple switches between scenes. I wonder if there might be a memory leak - but I'd be surprised if that could result in a heap corruption.

The main character can interact with other characters & indulge in conversations - this involves displaying a dialog & playing audio files. One of the characters is a "fairy godmother" who only appears as a model when she speaks - I've only ever seen the crash when she is required to speak. When the crash happens the dialog displays correctly, the fairy godmother AI is created (plus her magic wand with partical emitter is created & mounted to her) - but I never hear the audio file. The implication is the crash occurs as the attempt to load and/or play the audio file is made. Certainly a conversation with this character invokes more operations than with any other character.

There is another character who is usually in the vicinity of the main character. This character wears (has mounted) a necklace model. It is the original necklace model being present on this other character & in the same scene that appears to be the catalyst for the crash. I have replaced the necklace model with a much simpler one - since then, no crash.

I find it hard to believe a single model could, of itself, invoke a heap corruption, so I do wonder if (given playing long enough) I would still see the problem.

Has anybody had any similar experiences / know of any specific issues / got any suggestions to simplify debugging?

Many thanks in advance for suggestions.

#1
05/09/2013 (8:42 am)
i do not know if there happens any heap corruption or not.
but i also have faced same problem with some specific models.
from arteria 3d and dexsoft.

at 1st i thought problem was on that model.
so removed that and it was fixed.
but sometimes later it happens again.

so i trucked that and found a condition checking for selection an animation thread due to onCollsssion() was crashing it.
adding another check fixed it.

but still it poke around when large number of models try to spawn together and collide each other.

that's it.no other experience of crash due to model.

u better ask any experienced community member to test the model.
#2
06/09/2013 (1:42 am)
I have found a bug in the graphics if graphics memory exceeded:
http://www.garagegames.com/community/forums/viewthread/134295

A simple workround (reducing graphics memory demand) stopped also stopped my heap corruption.

I don't know if these two are directly related.
#3
06/14/2013 (4:55 pm)
Ops wrong thread... Sorry.