   dxut / dx9 / release conf. / releasing problem
  Hi everybody,could anyone help me with this problem: I have a standard VS2005 project, DX9 application (with DXUT). When I run it in the debug configuration, when exiting all the resources are properly released, but when I switch to release conf., then I have problems with one class, from which all the resources are not released at all.When I only switch the runtime library in release conf. to "Multi-threaded Debug (/MTd)" it works again and no other config options affect this behaviour. When trying to debug this 'release' version, I cannot 'watch' any variables in the class, in which resources are not released, though it works in other classes.The debugging for this class (its destructor, more precisely) is fully available, when I dispose it after e.g. resizing the window. These resources are released then as well, the problem is only when I'm trying to exit application. The same functions are called actually, all of them invoked from OnD3D9LostDevice.Any ideas?Thx.   
  The reason you can't see what's going on in the debugger while in Release mode is because optimizations are enabled.  With optimization turned on, instructions may execute out of order or not at all (same goes for your variables).  If the problem is fixed when you switch to the debug CRT, it's probably an issue where you went past the bounds of a buffer (the debug CRT will typically put padding around memory allocations).  I would suggest going back to the non-debug CRT, then disabling optimizations to see if you can debug what's going on.   ;  Thanks for your quick reply, MJP.here's what I know at this moment: when calling Release() on these resources (index and vertex buffers) nothing is changed but USAGE property (from 1 to 0 in both cases). The value returned by Release() is 0, and for one vertex declaration it equals 1. And this behaviour occurs not only when exiting my programme (what I thought at first), but also earlier, if I want to dispose it at that time.You also mentioned, that I probably went past the bounds of these buffers, anyways - I am pretty sure it's not the case, I don't modify it in my code after creation, the only manipulation comes from shaders. And index buffer is left untouched at all (apart from reading from it)... Or maybe I just mistunderstood you?   ;Quote:Original post by tete2Thanks for your quick reply, MJP.here's what I know at this moment: when calling Release() on these resources (index and vertex buffers) nothing is changed but USAGE property (from 1 to 0 in both cases). The value returned by Release() is 0, and for one vertex declaration it equals 1. And this behaviour occurs not only when exiting my programme (what I thought at first), but also earlier, if I want to dispose it at that time.Sounds like the vertex declaration is what's causing your problem then.  For any interfaces created by the d3d device, if they're not properly released it will prevent the device from releasing and cause a sort of cascade effect.  Quote:Original post by tete2You also mentioned, that I probably went past the bounds of these buffers, anyways - I am pretty sure it's not the case, I don't modify it in my code after creation, the only manipulation comes from shaders. And index buffer is left untouched at all (apart from reading from it)... Or maybe I just mistunderstood you?I wasn't talking about your vertex and index buffers, I was talking about anything you'd allocated with new (c-style arrays, stuff like that).  Anyway that's just the most common cause of these kinds problems, doesn't mean it actually applies to you.  (I just tend to say it as a boiler-plate response to these sorts of problems).   ;  Thank you very much :) I can remember that I fixed these vertex declarations' releasing, but it must have been in a parallel project...SOLVED :)   