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

Started by
1 comment, last by Endurion 11 years, 7 months ago
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.
Advertisement

Could someone give me some advice?

Yes, post some code.
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.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

This topic is closed to new replies.

Advertisement