tidy up on shutdown to allow multiple init/shutdown cycles per process#299
tidy up on shutdown to allow multiple init/shutdown cycles per process#299gkoulin wants to merge 2 commits intonmwsharp:masterfrom
init/shutdown cycles per process#299Conversation
|
thanks for this, it would be great to cleanly shutdown & reinitialize (some sloppy engineering on my part that I have put off fixing for many years) I'm afraid of some subtle bugs due to static variables. I have been gradually removing/consolidating static variables wherever possible, but there are still some hanging around. Also, openGL resource management & shutdown. After enabling tests, it looks like there's a huge amount of memory being leaked. I think maybe the |
…ocess - use `std::uique_ptr<Engine>` to manage global engine lifetime. This means that we no longer need `bool state::initialized`, we can just use the engine ptr to infer initialized state. - Hide window. - Clear `contextStack`. - Reset cached `lazy` properties. Had to convert from namespace to struct to allow default initialisation reset.
In `PolyscopeTest` fixture, initialise polyscope at the start of each test and shutdown at the end. This will test multiple shutdown cycles during the lifetime of the fixture.
|
Thanks for the feedback. I can't believe ASAN only checks memory leaks on GCC. That's really strange. Anyway, I've updated ownership of the engine. |
|
This looks to be superceeded by #311 |
contextStack.lazyproperties. Had to convert from namespace to struct to allow default initialisation reset.state::initialized = false.