tbb stalls when assigning new memory and other memory problems
I'm not 100% this is tbb's fault however I keep getting a stall in my game engine at random points when I assign new values to a dictionary and when using the new keyword.
Basically my use case is this - I load in an xml file as text. This is then parsed into xml and then I build an object tree from this, where elements and attributes are indexed using a dictionary.
When I'm assigning my new attributes to the dictionary every now and again it will stall.
Checking the call stack it seems to stick while doing the low level memory allocations for the new item, and at the highest level is the tbbmalloc_debug.dll which of course I can't inspect.
I've also had this problem when explicitly using the keyword "new" in my code to allocate new objects - although it's usually always the same class - my Bezier Curve class.
Here is the call stack for the bezier curve instance of the problem:
[Frames below may be incorrect and/or missing, no symbols loaded for tbbmalloc_debug.dll]
> Editor.dll!GEngine_Utility::InterpolatorFactory::createBezierCurve(D3DXVECTOR3 * controlPoints=0x7ee018a4, unsigned int numControlPoints=4) Line 35 + 0x7 bytes C++
[/bash] This is the code for the function within my code where the problem has occurred:
[cpp]IInterpolator* InterpolatorFactory::createBezierCurve(D3DXVECTOR3 *controlPoints, unsigned int numControlPoints)
if(numControlPoints < 4)
BezierCurve* newCurve = new BezierCurve();
}[/cpp] This is an excerpt from the bezier curve class header file:
[cpp]class BezierCurve : public IInterpolator
};[/cpp] And finally these are the relevant functions in the cpp file:
I should note that I'm using the tbb proxy dlls to allow for threaded memory allocation.
I'm also usingmbstowcs_s andwcstombs_s to convert between unicode and ascii strings - my app is in uni code, but the file handling operations are all ascii so I need to convert.
I've also had some problems with access violations whan calling the BezierCurve constructor that also seem to be coming from inside tbb. It fails I think with the error
As these problems are non-constant and seem to happen randomly I can only assume that it's some quirk with using the tbb library.
The functions I've described here are all run from within the same task of which there is only ever one instance.
For some reason this problem has only just cropped up. The only difference in my code now is that instead of running one simulation, I'm trying to run lots.
Has anyone got any ideas?? I've very close to my deadline now and this is the only problem I need to sort out. I'll keep invevstigating my memory clean-up and allocation incase there's something silly happening.