Stupid question about exiting a game

Lets just clean up the fact that I don’t use native code and if I did I would manually clean that up before I quit.

Now onto quiting a game in Java.

Using business apps, it isn’t a problem to save your file, database or whatever and just quit using System.exit(0);.

Games however are massive programs eating up hundreds of MB of memory and cleaning out system resources like a pirhana on the end of your pants.

My question is, should I use “System.exit(0)” to exit my game or should I let my game exit it’s main loop for a graceful exit?
What’s the difference between a graceful exit and forced exit in Java? Under C++ it could mean loose resources that don’t get cleaned but this shouldn’t be a problem in Java.

However, I would like confirmation on this just in case there is something special going on.

Even a C++ app shouldn’t have too many problems with just quitting. Any half-decent OS will automagically remove any extra resources that the process was using when it terminates.

The only things to watch for really are native resouces, specifically OpenGL / OpenAL stuff (destroying their context should cover all of it). Probably close down input handles for controllers etc. and of course and open files.

Thanks.