Jump to content

  • Log In with Google      Sign In   
  • Create Account


D3D9 memory still allocated


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
4 replies to this topic

#1 ElDuro   Members   -  Reputation: 492

Like
0Likes
Like

Posted 28 January 2013 - 08:16 PM

Direct3D9: (INFO) :MemFini!
Direct3D9: (ERROR) :Memory still allocated!  Alloc count = 143
Direct3D9: (ERROR) :Current Process (pid) = 000010b4

...

Direct3D9: (ERROR) :Total Memory Unfreed From Current Process = 2083940 bytes
Direct3D9: :====> EXIT: DLLMAIN(61d4d9a0): Process Detach 000010b4

 

I use these direct x objects, all of which I am sure I release() and set to NULL;

 

LPDIRECT3D9                               
LPDIRECT3DDEVICE9     

LPDIRECT3DVERTEXBUFFER9
LPDIRECT3DINDEXBUFFER9
LPD3DXSPRITE          

LPD3DXFONT               

map<wstring, LPDIRECT3DTEXTURE9>

 

PIX shows that the index and vertex buffer, created by the application, are never destroyed (I call release on both). It also shows that two d3d9 surfaces, created by direct3d, are never destroyed (usages: rendertarget and depthstencil).

 

When I call release() on the graphics device there is still a reference to it, so calling release on it again leaves no leaks. I doubt this is the solution, just doesn't seem right. What other methods would add a reference to the device? Or what could it be that I am missing? Thank you.

 

 



Sponsor:

#2 NewDisplayName   Members   -  Reputation: 351

Like
0Likes
Like

Posted 28 January 2013 - 10:31 PM

Looks like an ordering issue. Make sure that you're releasing your resources in the reverse order of creating and setting the corresponding pointer to NULL.



#3 C0lumbo   Crossbones+   -  Reputation: 2129

Like
0Likes
Like

Posted 29 January 2013 - 02:10 AM

I find that DX9 memory memory leaks are really hard to track down. I had a similar number of leaks which I tracked down to just a couple of issues in my code (I hadn't freed a  pixel shader object and a vertex declaration). But failing to release just a couple of objects means that directx itself doesn't shutdown properly which means that any bound textures and shaders aren't released either.

 

I suspect that it isn't ordering, but just some object that you've missed somehow. Working out which of your 143 leaks is the real problem versus which are just side effects of your leak is tricky.



#4 eppo   Crossbones+   -  Reputation: 2311

Like
0Likes
Like

Posted 29 January 2013 - 03:16 AM

What other methods would add a reference to the device?

 

Any call to IDirect3DDevice9::GetStreamSource or IDirect3DDevice9::GetIndices would increase the reference count on a buffer.



#5 ElDuro   Members   -  Reputation: 492

Like
1Likes
Like

Posted 29 January 2013 - 12:40 PM

Thanks. My problem was that I called D3DXCreateFont twice for the same object. A small, sneaky line created it the second time. The debug output was irrelevant in this case. The PIX object list output was also distracting. What worked best in this situation and probably will in most direct3d leak errors is to use PIX's  "log of all D3D calls made in frame number:" on frame one.






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