[cpp]#includeint main() { IDirect3D9 *pD3D = Direct3DCreate9(D3D_SDK_VERSION); pD3D->Release(); return 0; } [/cpp]
Link Copied
I can reproduce this problem after installing the Microsoft DirectX SDK (June 2010) - then built a simple test case, ran Inspector XE 2011 Update 5 (build 180252), it detected "Kernel resource leak", actually it waswrong report since we have "pD3D->Release();"
Is it possible that Inspector hasn't detected (tracked) resource release in pD3D->Release()?
[cpp]#include "stdafx.h" #include#include #include void loop_foo() { for (int i=0; i<3; i++) { IDirect3D9 *pD3D = Direct3DCreate9(D3D_SDK_VERSION); pD3D->Release(); } } int _tmain(int argc, _TCHAR* argv[]) { //IDirect3D9 *pD3D = Direct3DCreate9(D3D_SDK_VERSION); //pD3D->Release(); loop_foo(); return 0; } [/cpp]
I will report this to dev team, and post again if there is progressor solution.
Regards, Peter
For more complete information about compiler optimizations, see our Optimization Notice.