tbb stalls when assigning new memory and other memory problems

tbb stalls when assigning new memory and other memory problems

rythblade's picture

Hi there, 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:

 	tbbmalloc_debug.dll!593e228e()

 	[Frames below may be incorrect and/or missing, no symbols loaded for tbbmalloc_debug.dll]

 	tbbmalloc_debug.dll!593e1f5e()

 	tbbmalloc_debug.dll!593e2fab()

 	tbbmalloc_debug.dll!593e2ef1()

 	tbbmalloc_debug.dll!593e397d()

>	Editor.dll!GEngine_Utility::InterpolatorFactory::createBezierCurve(D3DXVECTOR3 * controlPoints=0x7ee018a4, unsigned int numControlPoints=4)  Line 35 + 0x7 bytes	C++

This is the code for the function within my code where the problem has occurred:
IInterpolator* InterpolatorFactory::createBezierCurve(D3DXVECTOR3 *controlPoints, unsigned int numControlPoints)

	{

		if(numControlPoints < 4)

		{

			return NULL;

		}
		BezierCurve* newCurve = new BezierCurve();
		newCurve->setControlPointAt(0, &controlPoints[0]);

		newCurve->setControlPointAt(1, &controlPoints[1]);

		newCurve->setControlPointAt(2, &controlPoints[2]);

		newCurve->setControlPointAt(3, &controlPoints[3]);
		return (IInterpolator*)newCurve;

	}
This is an excerpt from the bezier curve class header file:
class BezierCurve : public IInterpolator

	{

	private:

		D3DXVECTOR3 m_controlPoints[4];
	public:

		BezierCurve();

		~BezierCurve();

	};
And finally these are the relevant functions in the cpp file:
BezierCurve::BezierCurve()

	{

		VectorUtilities::setVector(&m_controlPoints[0], 0.0f, 0.0f, 0.0f);

		VectorUtilities::setVector(&m_controlPoints[1], 0.0f, 0.0f, 0.0f);

		VectorUtilities::setVector(&m_controlPoints[2], 0.0f, 0.0f, 0.0f);

		VectorUtilities::setVector(&m_controlPoints[3], 0.0f, 0.0f, 0.0f);

	}
	BezierCurve::~BezierCurve()

	{

	}
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.

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Vladimir Polin (Intel)'s picture

Hello, could you puttbbmalloc_debug.pdb next totbbmalloc_debug.dll? Getting stack would be more useful than just numbers:) Thanks, Vladimir

Login to leave a comment.