Jump to content
  • Advertisement

Archived

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

Zipster

Proper Resource Disposal :: Managed DirectX

This topic is 5222 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

Sometimes when I exit my managed DirectX application, it will hang inside the main form''s Dispose function (when I break the application, it references the closing bracket). I can only assume that this means it''s having trouble disposing of my DirectX resources. Right now, I have a Direct3D device, a single vertex buffer, and a collection of objects that manage their own index buffer. Each object has a reference to the Direct3D device so it can call DrawIndexedPrimitives. When I add call to Device.Dispose() to the form''s dispose function, when I break the application after it hangs, the breakpoint is on the statement immediately following the Dispose call. This is why I assume there is a problem disposing of the graphics device. I''ve verified that it only hangs when the vertex buffer is created and each object holds a reference to the device. I''m just looking for some suggestions on how to safely dispose of all my resources, and make sure my application doesn''t try to access them after they''ve been disposed of. Also, any ideas as to why it would hang on disposal would be greatly appreciated

Share this post


Link to post
Share on other sites
Advertisement
I had the exact same problem and it was because my device dispose was out of order as mohamed suggested to you to look at. In my case it didn''t happen alot maybe 1 out of 20 times but was enough to look into :-)

Share this post


Link to post
Share on other sites
I don''t really have that many resources, and even when I add a call to Device.Dispose it hangs, on that very call. Sometimes not for very long, but sometimes for so long that I have to end the process before it''s complete.

Disposing of the vertex buffers and index buffers is no problem, but it really doesn''t like disposing the graphics device. Could it have to do with the device trying to dispose of the vertex/index buffers itself?

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!