Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

IH82W8

DX9 not releasing memory?

This topic is 5389 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there, I've got a strange problem with my D3D9 application. Once i ran the debugger, it indicated that there is still memory allocated:
Direct3D9: (ERROR) :Memory still allocated!  Alloc count = 329
Direct3D9: (ERROR) :Current Process (pid) = 00000ab8
Direct3D9: (ERROR) :Memory Address: 00c840ac lAllocID=1 dwSize=000047f8, ReturnAddr=00f73206 (pid=00000ab8)
Direct3D9: (ERROR) :Memory Address: 00c8ae04 lAllocID=9 dwSize=000017a0, ReturnAddr=00f6dba9 (pid=00000ab8)
Direct3D9: (ERROR) :Memory Address: 00c8c5dc lAllocID=10 dwSize=00000004, ReturnAddr=00f6dc49 (pid=00000ab8)
Direct3D9: (ERROR) :Memory Address: 00c8c614 lAllocID=11 dwSize=000007c0, ReturnAddr=00f729b5 (pid=00000ab8)
Direct3D9: (ERROR) :Memory Address: 00c8d0a4 lAllocID=20 dwSize=000006bc, ReturnAddr=00f7eb9f (pid=00000ab8)
Direct3D9: (ERROR) :Memory Address: 00c888dc lAllocID=22 dwSize=00001b6c, ReturnAddr=00f741fb (pid=00000ab8)
Direct3D9: (ERROR) :Memory Address: 00c828c4 lAllocID=24 dwSize=00000004, ReturnAddr=00f7432c (pid=00000ab8)
Direct3D9: (ERROR) :Memory Address: 01130064 lAllocID=26 dwSize=00003500, ReturnAddr=00f73206 (pid=00000ab8)
Direct3D9: (ERROR) :Memory Address: 00c8d794 lAllocID=27 dwSize=00000198, ReturnAddr=00f73206 (pid=00000ab8)
Direct3D9: (ERROR) :Memory Address: 00c8ce0c lAllocID=28 dwSize=00000030, ReturnAddr=00f73206 (pid=00000ab8)
Direct3D9: (ERROR) :Memory Address: 0113359c lAllocID=29 dwSize=00001020, ReturnAddr=00f73206 (pid=00000ab8)
Direct3D9: (ERROR) :Total Memory Unfreed From Current Process = 53360 bytes
53360 bytes.. the exact amount you get when forgetting to release both your device and dx-object. So I looked up the memory where the object is located, and on the m_pDirect3DObject->Release() call, only one single byte within that block was changed - the release call did NOT free the allocated memory block. I tried with other applications, and they clean their object memory just fine. Does anyone have any idea why my release call fails (for both the device and object?) Thanks in advance! [edited by - IH82W8 on September 22, 2003 8:30:12 AM]

Share this post


Link to post
Share on other sites
Advertisement

The object still has one or more references.

DirectX uses COM reference counts for its objects. Release() only frees an object when its reference count goes to 0, so if AddRef() has been called on an interface (explicitly or during the operation of another call), then you''ll need to make an extra call(s) to Release() to decrement the reference count.

Any Get*() or Set*() call that returns or takes an interface usually performs an AddRef() such as IDirect3DDevice9::GetDirect3D for example usually increases the reference count.


As a debugging aid, the return value from Release() tells you what the current reference count is.


--
Simon O''Connor
3D Game Programmer &
Microsoft DirectX MVP

Share this post


Link to post
Share on other sites
Thanks a lot Simon, I didn''t know that. So I''d better get rid of those get calls - they really do sum up references.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!