Jump to content

  • Log In with Google      Sign In   
  • Create Account

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


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Ehzyo   Members   -  Reputation: 105

Like
0Likes
Like

Posted 11 September 2012 - 09:23 PM

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.

Sponsor:

#2 Ashaman73   Crossbones+   -  Reputation: 7459

Like
0Likes
Like

Posted 11 September 2012 - 11:54 PM

Could someone give me some advice?

Yes, post some code.

#3 Endurion   Crossbones+   -  Reputation: 3573

Like
0Likes
Like

Posted 12 September 2012 - 12:23 AM

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>




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS