• Advertisement
Sign in to follow this  

DirectX memory leaks

This topic is 4248 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am using the book 3D Game Engine Programming by Stefan Zerbst to help design my first engine but I am getting a User Breakpoint error every time I exit my application. my problem is this little warning Direct3D9: (WARN) :Total Memory Unfreed From Current Process = 664852 bytes I tried to isolate any possible memory leaks by commenting out parts of my engine and found that the error only happens when i call CreateAdditionalSwapChain. the really bizarre thing is this wasn’t happening before. I tried using a backup build that was working fine before and its now doing the same thing (at least I don’t think there was a problem its been a while). I am probably not cleaning up DirectX properly and the book I am using isn’t helping so any advice I can get would help a lot.

Share this post


Link to post
Share on other sites
Advertisement
You are not releasing all of your DX resources. When you exit your program and do the final pDevice->Release() it returns its current ref count, which should be 0 if you released everything.

I put a check for this in my program and if the count is not 0 display a message box showing the count. At least that way I can see how many interfaces remain. This does not work though for resources not connected to your device, like the animation controller interface.

Are you also running with the debug directx runtimes?

Share this post


Link to post
Share on other sites
the ref count is 4 when I releace the device and that is the amout of times I call CreateAdditionalSwapChain

Yes I am useing the DirectX runtimes

Just tryed calling Releace on my LPDIRECT3DSWAPCHAIN9 objects and now there is no leaks :)

[Edited by - WarPenguin on July 8, 2006 1:27:22 PM]

Share this post


Link to post
Share on other sites
For future reference, there is an easy way to find out where these leaks occur. Specifically, the debug output gives you a list of all of the leaked resources, along with their type, size, and allocation ID. You can then use this allocation ID to fire off a breakpoint when that specific resource is created (this is done by setting up the alloc id in the control panel, then debugging).

For more info, check out this KBase article.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement