Should a game/engine clean up after itself(close windows, shut down renderers, close files, free memory) when its closed?
The OS should do that anyway, and usually in a faster way.
I guess most developers don't really care as they need proper cleanup for everything anyways(With dynamic asset-loading, and changing maps, etc.), but won't ensure that everything gets cleaned perfectly.
But is there any positive to cleaning up vs not cleaning up or the reverse?
I am using C++.
What about game consoles? Do they all clean up after themselves?
Answer
Yes, a game/engine should clean up after itself when it's closed. There are good reasons for that:
- Show to your team that you know what's going on in your game
- Know when your managers are shut down
- Make sure your files and handles are closed and your data is saved
- Help prevent crashes on exit because you have a better idea to what's going on
- Help find memory leaks: if you clean everything yourself, you should not have any memory leaks, so the next time you use a tool to detect them, it should give you 0 leaks. You'd have a harder time achieving this if you don't clean on shutdown.
And it smells fresher when stuff is clean!
No comments:
Post a Comment