   To mem leak, or not to mem leak... I'd prefer not...
  So I just recently turned on the D3D Debug Dlls and cranked it all the way up to see what it''d tell me. And it''s claiming that i''m leaking 45096 bytes.However, I have the windows debug mem leak checker going and it tells me i''m not leaking anything... who do I believe?!Now, assuming the worst I may as well ask you now... how am I leaking... I''ve got the device and d3d object released....Do I have to actually ->Release() the vertex buffer?I''m thinking it might be textures... here''s my D3D releasing stuff...   CGraphics::~CGraphics(){ClearTextures();//if(m_pVertexBuffer)//m_pVertexBuffer->Release();m_pVertexBuffer = NULL;if(m_pDevice)   m_pDevice->Release();m_pDevice = NULL;    if(m_pDirect3D)m_pDirect3D->Release();m_pDirect3D = NULL;}void CGraphics::ClearTextures(){std::vector<LOADEDTEXTURE*>::iterator it;// cycle through the listfor(it = LoadedTextures.begin(); it != LoadedTextures.end(); it++){// release textureif((*it)->pTexture)(*it)->pTexture->Release();(*it)->pTexture = NULL;   delete (*it);}LoadedTextures.clear();}As far as I know that should do it....Only have a small 2D game going here...   - Newb Programmer: Geek++ 
  Yes, any object that has a ''Create'' call (INCLUDING the MatrixStack interface surprisingly) has to be released with a Release() call.  This is because the object was created in the Direct3D memory space, and you cannot release it in your memory space, so you call Release() to indicate that you don''t need it anymore and Direct3D can delete it.   Chris PergrossiMy Realm | "Good Morning, Dave" ;quote:Original post by GeekPlusPlus  So I just recently turned on the D3D Debug Dlls and cranked it all the way up to see what it''d tell me. And it''s claiming that i''m leaking 45096 bytes.However, I have the windows debug mem leak checker going and it tells me i''m not leaking anything... who do I believe?!Both. The Windows checker tells you if you''re leaking conventional memory through calls to ''new'' that are missing a ''delete''. The D3D debug runtimes tell you if you''re leaking Direct3D resources (typically forgetting a Release(), or putting the Release() call for different objects in an invalid order).;  Since two weeks ago I was tracing same leaks, I can give you advice on how to clean it.Technically, you are creating your DirectX resources either before   the Render () function/loop or inside   the Render () function/loop.1.   So, we`ll first eliminate those leaks that could happen before Render () was called first time.You shall remark all sections of code inside Render () (and leave only BeginScene/EndScene) and start remarking  the initialization stuff, line after line.I also assume all of your resources are defaulted to NULL in their constructors, so the destructors/release code doesn`r complain (I also assume that in releasing you`re checking whether the object is NULL or not).That way you`ll eventually get to the point when the Debug shall spit at you the error. And since you were doing it line after line, you know exactly what isn`t being released properly. Then you`ll have one quick look into Destructor/RelaseMemory function of the class in question, and you`ll see that it was the problem.2.   If the above steps didn`t help, then you`re cerating something during the Render function which, obviously, can be correctly remarked only with your thorough knowledge of interdependancies between various parts of it. But the principle stays the same - find the place where you create some texture/vertex/index buffer and check if it has corresponding release code.BTW, I managed to get rid of about 15 different dx mem leaks this way in about 5 hours of intense debugging and then my dx debug output was clean as if cleaned by Vanish  VladR Avenger 3D game (Last update FEB-04);  You should use a smart COM pointer to eliminate leaks. Try CComPtr from atlbase.h (with VC++)   Muhammad Haggag