Jump to content
  • Advertisement
Sign in to follow this  
rAm_y_

Why is your computer slow when you close game?

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

Or can be slow/sluggish foor a good 30sec-2min etc.

 

Now your going to say it's because all/or most of the memory has been used for game resources so there is some process of deallocating and reallocating memory by the OS. But why so slow, it can take a minute or more for the PC to recover, what is actually going on behind the scenes, is it not similar to deleting a file on the HD, the pointer to the file is removed however the files data(bit and bytes) still remain until it's written over by other bits of data, so why can it be so slow to deallocate a bunch of memory, shouldn't it be instantaneous, what is going on under the hood?

Share this post


Link to post
Share on other sites
Advertisement

Depends on the game.

 

One potential cause is how C++ enforces cleanup even when the program and the programmer may find it unnecessary.  A vivid description I've read has been this is like taking out the trash cans right before demolishing the building. The language rules can mean you can waste a lot of time doing careful, neat, proper cleanup on all the individual items even when it is completely unnecessary.

 

Quite a few game-centric memory managers offer teardown functions that don't bother with destructors or other cleanup, just release the memory and resources all at once. They don't waste time destroying individual objects, the entire memory pool is simply reclaimed. 

 

When programming systems don't allow this kind of scenario, other programs will take steps to hide their UI quickly and make them appear dead as the cleanup takes place in the background, much like you described.

Share this post


Link to post
Share on other sites

Oh, also, if this is your own code, don't forget about or underestimate the power of exit(), terminate(), abend(), signalling yourself with stop or kill, or otherwise artificially terminating your program rather than spending the time calling several hundred thousand destructors and releasing several hundred thousand tiny allocations.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!