Memory cleanup

I’m working on a game in pure C++, using the Panda libraries from native code. Overall, it has gone well so far, but I ran into something over the wekend that I’m looking for input on.

My game starts up with a display settings dialog that lets the user choose either DirectX or OpenGL along with which resolution they want to run under as well as fullscreen/windowed, etc. I wanted to display this dialog on startup and after they exit the game to give them the option to replay with different settings. I noticed that despite the fact I was destroying all my windows, the Panda framework, etc, the GSG that I created wasn’t being released. After a lot of looking around I noticed that this was due to the fact that there are a number of global caches (ie. geometry cache) that don’t get cleared at any point, so the ref-counts never decrease to 0, deleting all the associated objects.

The big question is whether there is a reliable, one-call API that will put the application back into the state it was in immediately on startup? I’d like to clear all my caches and even force configuration data to be reloaded. Does such a thing exist? Thanks.

I don’t think so, frangro. The most reliable way, if you really wanted to reinitialize, would be to have the application just relaunch itself.