Archived

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

ms291052

Memory Leak in D3DXIntersect?

Recommended Posts

ms291052    223
I''m calling this function for my ColDet by using:
bool PointInRoom(D3DXVECTOR3 pos)
{
	D3DXVECTOR3 up = D3DXVECTOR3(0.0f, 1.0f, 0.0f);
	BOOL bHit;
    DWORD dwFace;
    FLOAT fBary1, fBary2, fDist;
	LPD3DXBUFFER idb;
	DWORD count;
	D3DXIntersect(g_Room.m_pMesh, &pos, &up, &bHit, &dwFace, &fBary1, &fBary2, &fDist, &idb, &count);
	if(count%2) return true;
	else return false;
	idb = NULL;
	return 1;
}
and it''s causing quite a memory leak. I assume it''s my code and not the function but I''m not 100% sure on why.

Share this post


Link to post
Share on other sites
Vulcan    122
Fairly sure its because you don''t ->Release() that LPD3DXBUFFER. And since it doesn''t appear your a re using it, you can just pass in 0.

regards,
-Eric

Share this post


Link to post
Share on other sites