   Tracking Down Memory Leaks
  I have the Debug version of DirectX running and it's telling me I have a bunch of unfreed memory in my program. Unfortunately I can't understand the ouput. How can I turn this into logical information I can use to find the source of the problem?Direct3D9: (WARN) :Memory Address: 014f83b0 lAllocID=481 dwSize=00000112, (pid=000003dc)Direct3D9: (WARN) :  Stack Back TraceDirect3D9: (ERROR) :    [0] : Address 011BD4CBDirect3D9: (ERROR) :    [1] : Address 011BD59BDirect3D9: (ERROR) :    [2] : Address 011BD440Direct3D9: (ERROR) :    [3] : Address 0122B0F1Direct3D9: (ERROR) :    [4] : Address 0123FBADDirect3D9: (ERROR) :    [5] : Address 0123FAF7Direct3D9: (ERROR) :    [6] : Address 012322DBDirect3D9: (ERROR) :    [7] : Address 0079BCFFDirect3D9: (ERROR) :    [8] : Address 0079A6FADirect3D9: (ERROR) :    [9] : Address 0078B9EBDirect3D9: (ERROR) :    [10] : Address 0046F9C0Direct3D9: (ERROR) :    [11] : Address 00470B1BDirect3D9: (ERROR) :    [12] : Address 0046D063Direct3D9: (ERROR) :    [13] : Address 0047140ADirect3D9: (ERROR) :    [14] : Address 00526C66Direct3D9: (ERROR) :    [15] : Address 005269CD
  The main problem with this memory reports is that one not released object caused many others. That makes it hard to find the real source.  A general advice is to start with the leak that have the highest AllocID.  If it is always the same you can set the “Break On Alloc ID” Direct3D option to this number and the debugger will stop your program at the right moment. You can although use PIX and look which objects are still alive before you call your final release on the device. The hard way is to generate a list with all the function addresses of your code (called map file) and search by hand. You can find the option to generate such a file in the linker options.   ;  I found the problem. I created a wrapper of sorts for the ID3DXEffect* object for my manager like this:class SimShader{public:SimShader(void) { shader = NULL; }~SimShader(void) { if(shader != NULL) shader->Release(); }ID3DXEffect *shader;const char*name;};And then I have my shader manager containing a vector of pointers to these objects so I can easily just create more effects. The problem came from the fact that the pointers I created are not automatically destroyed at the end of the program because they were created with 'new' so I just went back and made a simple destructor like this to fix the problem:SimShaderManager::~SimShaderManager(void){vector<SimShader*>::iterator itr, itr2;itr = itr2 = shaders.begin();itr2++;for(;itr2 != shaders.end(); itr2++){delete (*itr);itr = itr2;}delete (*itr);}