   D3D: Device out of Memory
  Hey-This is my first time posting, so I apologize if anything is unclear.  My current problem is that I am attempting to debug some software written for my lab.  Currently, we are using Direct3D 9 to run a graphics panel as a portion of a larger display software package.  My primary question is regarding the structure of the current code.As it stands, any time the window is resized (meaning the graphics panel/D3D target get resized), the entire Direct3D hierarchy is destroyed (supposedly...).  Everything down to the object is destroyed.  However, after a couple of resizing of the screen (or toggling between fullscreen and windowed mode), the Direct3D object is created successfully, but the device cannot be created due to lack of memory.So, two questions:  (1) is it appropriate (or necessary) to delete the object every time?  And if so, am I most likely running out of memory because at least one of the data structures used was not deleted properly?  And (2), if I am running out of memory due to poor deletion practices, is there a "cheap" way to start anew (as in, reclaim the memory of the graphics card) without having to close and reopen the program?  Obviously, the second would be considered poor coding practice, but in this situation, a dirty fix is better than nothing (so we can get the program usable while I hunt down who/what isn't being properly deleted).  Thanks in advance for any input, and if any more information is needed, I'll answer what I can.   
  Destroying your device is definitely overkill.  If you need to resize the backbuffer, you can just reset the device to do this.In some cases you may not even need to reset the device...for instance if the window is getting smaller, you could just adjust your viewport rather than resizing the backbuffer again.  However things might get tricky if you use many render targets, or if you have code that makes calculations based on the backbuffer size.   ;  If you're completely destroying the device and you're still running out of memory, that implies to me that you've got a memory leak somewhere. Do the Debug Runtimes say anything?If you are leaking, then Reset() will probably fail too, so you'll want to fix the leaks, and then switch to using Reset() to change resolution.   ;  Thanks for the help so far!  After further investigation, it seems as if everything *should* be properly allocating and deallocating memory, but the computer is handling function calls in a non-linear fashion.  It appears that for some reason pointers have been changed before the memory to which they point to has been freed.  I'm working on slowing down the software to account for this, but knowing that releasing the object/device everytime is unnecessary does help as I'm modifying the existing code.  Thanks again for the help.   