Sign in to follow this  
Ehzyo

Memory Leak : Release() return 0 but DestroyObject not called

Recommended Posts

1. Two IDirect3DVertexDeclaration9 objects allocated by the function FindNextValidTechnique() are released but not destroyed. In PIX, the status "App Refs" is "0", but the status "Destruction" is "Never".
2. An IDirect3DIndexBuffer9 object allocated by the application is released but not destroyed. In PIX, the status "App Refs" is "0", but the status "Destruction" is "Never". After I call the function SetIndices(NULL), the memory leak of the index buffer disappears.
3. An IDirect3DVertexShader9 and an IDirect3DPixelShader9 object allocated by the function D3DXCreateEffect() are released but not destroyed. In PIX, the status "App Refs" is "0", but the status "Destruction" is "Never". However, After I call SetVertexShader(NULL) and SetPixelShader(NULL), the memory leak of the two disappear.
4. An IDirect3DSwapChain9 object allocated with the function CreateAdditionalSwapChain() is released but not destroyed. GetBackBuffer() is ever called, but the Surface is released later. In PIX, the status "App Refs" of them is "0", but the status "Destruction" of them is "Never".
5. Of cause, the IDirect3DDevice9 and IDirect3D9 object are released but not destroyed.

I'v checked the reference counts of all the objects in PIX and application. They are both 0. I don't know why the memory leak still occurs. And I don't think SetIndices(NULL) etc. are necessary. Could someone give me some advice? Thank you.

Share this post


Link to post
Share on other sites
If you have any resources selected (bound) in the device they are locked and will not be freed. Exactly what you thought about, SetIndices, SetVertexShader etc. is necessary, if the object you want to release is still referenced in there.
Imagine what happened if the resource was actually released.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this