Original Post
I went to debug my application and the debugger told me I had nine objects still allocated in memory. Fine, I go to my DX thing and break on AllocID, and put in each AllocID from the debug spew. Now, I did this for each unique AllocID (of which there were five), and they all only pointed to two lines, both in my init function, however I thought I was deleting them all in my cleanup function. Take a look at the following.
Debug Spew: (line of code appended after each line)
Direct3D9: (ERROR) :Memory Address: 0039b3dc lAllocID=11 dwSize=00000140, ReturnAddr=03872f45 (pid=00000fe4) -- g_pD3D = Direct3DCreate9( D3D_SDK_VERSION ); Direct3D9: (ERROR) :Memory Address: 0039b3dc lAllocID=11 dwSize=00000140, ReturnAddr=03872f45 (pid=00000fe4) -- Same As Above Direct3D9: (ERROR) :Memory Address: 0039b3dc lAllocID=11 dwSize=00000140, ReturnAddr=03872f45 (pid=00000fe4) -- Same As Above Direct3D9: (ERROR) :Memory Address: 003996ac lAllocID=22 dwSize=00001008, ReturnAddr=0387478b (pid=00000fe4) -- g_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE , &g_d3dpp, &g_pd3dDevice ); Direct3D9: (ERROR) :Memory Address: 0039a784 lAllocID=24 dwSize=00000008, ReturnAddr=038748bc (pid=00000fe4) -- Same As Above Direct3D9: (ERROR) :Memory Address: 0039a784 lAllocID=24 dwSize=00000008, ReturnAddr=038748bc (pid=00000fe4) -- Same As Above Direct3D9: (ERROR) :Memory Address: 0039ea6c lAllocID=27 dwSize=00000198, ReturnAddr=03873796 (pid=00000fe4) -- Same As Above Direct3D9: (ERROR) :Memory Address: 0039ec2c lAllocID=28 dwSize=00000030, ReturnAddr=03873796 (pid=00000fe4) -- Same As Above Direct3D9: (ERROR) :Memory Address: 0039ec2c lAllocID=28 dwSize=00000030, ReturnAddr=03873796 (pid=00000fe4) -- Same As AboveInit Function:
HRESULT InitD3DWin( HWND hWnd )
{
g_pD3D = Direct3DCreate9( D3D_SDK_VERSION );
ZeroMemory( &g_d3dpp, sizeof(g_d3dpp) );
g_d3dpp.Windowed = TRUE;
g_d3dpp.EnableAutoDepthStencil = TRUE;
g_d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
g_d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
g_d3dpp.BackBufferWidth = DEVICEWIDTH;
g_d3dpp.BackBufferHeight = DEVICEHEIGHT;
g_d3dpp.BackBufferFormat = D3DFMT_A8R8G8B8;
g_d3dpp.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
g_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
g_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
g_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE , &g_d3dpp, &g_pd3dDevice );
OneTimeSceneInit();
return S_OK;
}
Cleanup Function:
#define SAFE_RELEASE(p) if(p != NULL){(p)->Release();(p)=NULL;}
void Cleanup()
{
//...
SAFE_RELEASE(g_pd3dDevice);
SAFE_RELEASE(g_pD3D);
}
WinMain:
int WINAPI WinMain( HINSTANCE hinst, HINSTANCE, LPSTR, int )
{
//CreateWindow
if( SUCCEEDED( InitD3DWin( hWnd) ) )
{
if( SUCCEEDED( InitGeometry() ) )
{
ShowWindow( hWnd, SW_SHOWDEFAULT );
UpdateWindow( hWnd );
MSG msg;
ZeroMemory( &msg, sizeof(msg) );
while( msg.message!=WM_QUIT )
{
if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
else
{
Render();
}
}
}
}
Cleanup();
//ReleaseWindow
return 0;
}
So... This leads me to three questions:
1) Does it mean anything that different AllocID id''s point to the same line?
2) What does it mean that the same AllocID and (apparently) same object is shown twice?
3) What could possibly be going wrong? Is D3D definately pointing me to the right place?
Thanks for all your time and thought,
ms