GMS 2.3+ game_end() ?

Neptune

Member
I've had some reports of hang time, not responding, and RAM climbing in task manager upon calling game_end()
Any ideas on how I can optimize or lessen the load for this?
Thanks :)
 

rytan451

Member
Look at your Clean Up and Game End events. The lag would likely be caused by those. Remember that the debugger is also very useful for identifying what code is taking the most time.

If the problem persists in an empty project with no Clean Up or Game End events, then this may be a bug.
 

Neptune

Member
@rytan451 Thanks for reply.
So I definitely have some hefty clean-ups here and there - are these fighting with the game_end() ? Trying to cleanup twice perhaps?
 

Neptune

Member
Currently, for the larger global data structures that are constantly in RAM while the project is running,I do not clean them up manually, I assumed game_end() would take care of it, when the time came.
 

rytan451

Member
Hi, sorry for the late response.

When you call game_end(), all of these Clean Up events occur before the game process ends. All of the data used by the game (like your large global data structures) are automatically cleared by the OS when the game process ends. However, if you don't delete these large global data structures on Clean Up, then after calling game_restart() or room_restart() can cause the data structures to remain in memory even when the references to them are lost, leading to a memory leak.

Avoid performing too much code in the Clean Up events, especially intensive loops or file access. Of course, you know better than I what is in your Clean Up events.

Have you used the debugger to figure out which Clean Up event is taking up the most time?
 

Neptune

Member
I never use room_resart or game_restart, so I'm clear there. I will try the debugger and see which cleanup is causing the hanging!
 
Top