Jump to content
  • Advertisement
Sign in to follow this  
Matt_Aufderheide

DX11 Releasing resources on exit

Recommended Posts

is it a good idea to release resources in DX11 when you exit an application these days... if you don't what problems can happen?

Currently in my app I don't release anything on exiting... and so far no problems.. but I suppose this is not good.. In DX9 it could sometimes cause problems I seem to recall.

The reason I don't release stuff right now is just because it's tedious...no real better reason.

Share this post


Link to post
Share on other sites
Advertisement

I think it depends what you intend to do with the final bits. If for instance you are creating a middleware SDK that could be rendering in one or more C# SwapChainPanels provided by the WRT, then resource consumption would grow without ever decreasing. If your just using your code in a legacy Win32 desktop app, everything will be cleaned up for you by the runtime and OS when your app terminates (cleanly or not).

Share this post


Link to post
Share on other sites

Note also that this will be considered as a non-cleaned code.

And if, for some reasons (ie a bug on DX side or Windows side), these resources are not freed, then you might run into issues.

Share this post


Link to post
Share on other sites

If releasing resources is tedious, you're doing it wrong.  Use RAII.  Use smart pointers such as ComPtr.  Do not ever use a raw pointer to "own" a resource, unless you are writing your own smart pointer class.

In a well-written program, releasing resources is something that happens effortlessly.

Share this post


Link to post
Share on other sites

Well I should explain...basically  I don't have to worry about "ownership".. the resources are all global pointers...and I don't use classes and such and there is no "scoping" of pointers.. this is a pretty simple game program

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!