1

When I call Release() on my Direct3D9 interface, the programs stops immediately and under the debugger, I have the following output:

VERIFIER STOP 00000900: pid 0x570: A heap allocation was leaked.  

In my code, I create and free the D3D9 interface this way:

IDirect3D9 *pD3D = Direct3DCreate9( D3D_SDK_VERSION );
// Do some work...
pD3D->Release();
pD3D = nullptr;

Between the creation and release of the interface, I am able to use it normally.

This is the first time I have something like this happening and I have absolutely no clues of what is going wrong. It may be a problem with my DirectX installation but I have other software using Direct3D9 running without any problems.

Punkfloyd
  • 45
  • 4
  • Somewhere else you are calling AddRef on this object and not Release. – user253751 Jul 04 '16 at 04:55
  • @immibis Thanks for your reply, however, I tried releasing my D3D9 object right after its creation and I got the same problem. Plus, this is the only part where my application deals with Direct3D. – Punkfloyd Jul 04 '16 at 13:57
  • What operating system are you using? Are you using the Debug Developer Runtime? – Chuck Walbourn Jul 04 '16 at 18:07

1 Answers1

1

It seems that you attched "Application Verifier" to your EXE. Appverif checks for memory leaks and it found one. If you read the full output, appverif gives you the stacktrace of the leaked allocation. You can display it by debugging your EXE with WinDbg and run the command dps STACKTRACE_ADDRES. The memory leak can come from your //do some work... code, maybe you forgot to release a referenced d3d object. It also happens that Graphical Drivers causes memory leaks detected by appverif, in this case just remove your EXE from appverif. Finaly Windbg will tell you the culprit.

M'hand BOUGHIAS
  • 730
  • 10
  • 13
  • You were right about the last part. I tried releasing D3D9 object right after its creation and I got the same problem, and from what I've seen, the leak reported by the app verifier is not located in my application code. Anyway, I removed my exe from app verifier and everything is fine! Thanks :) – Punkfloyd Jul 04 '16 at 13:53