DirectX memory leaks
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.
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?
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?
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]
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]
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.
For more info, check out this KBase article.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement