What is the best way to shut down a packaged HTML5 game without leaking memory from UE4/Emscripten/DOM? Other than just exiting / leaving the current page, of course.
Game.html.template has a Quit button commented out, which calls __exit(0). This seems to have no effect when un-commented.
Other things I’ve tried:
- Calling Module.exit() on the JS side reports that exit() is undefined.
- Calling Module.abort() freezes the execution, but throws a console error message/alert, and doesn’t seem to free memory.
- Binding an extern C function inside UE4 which calls emscripten_cancel_main_loop. This successfully interrupts the game without error messages, but leaks all memory (i.e. nothing seems to be freed).
If anybody has any other ideas, your help would be greatly appreciated!
EDIT: Calling the “quit” console command from C++ doesn’t work either. Nor does setting the global GIsRequestingExit variable to “true.”