HayManMarc
Member
I was checking for memory leaks in my latest project when I noticed that simply switching rooms increased the memory usage. I'm about to create a test project and I'll post the results when I'm done.
----builds test project----
Yep, same numbers in the test project.
I would appreciate it if a few others would test this test project I made: http://haymanquarterly.com/GMC/Mem_Leak_Room_Switch_Test.zip
The test project is made with GMS2 v2.2.1.375 Runtime v2.2.1.291. It is just two rooms, one object, and one sprite. room0 is a persistent room. room1 is not persistent. The object is in both rooms and switches rooms per keyboard_check_pressed. Space bar is used to switch rooms.
When you switch from room 0 to room 1 (from a persistent room to a non-persistent room) there is no increase (however, the debugger shows a slight increase). But going the other way from room 1 to room 0 (a non-persistent room to a persistent room), there is a 152k increase to memory.
I checked it with both rooms NOT persistent resulting with no more memory increase.
I tried it with both rooms persistent and the 152k increase was with every room change.
It would seem that persistent rooms have a memory leak when you are switching to them.
I'm using the Windows Task Manager to see the memory increase. The GMS debugger is showing the increase as well, but with slightly different numbers.
Am I correct calling this a memory leak? Or is it normal for games to consume a small amount of memory while being played?
----builds test project----
Yep, same numbers in the test project.
I would appreciate it if a few others would test this test project I made: http://haymanquarterly.com/GMC/Mem_Leak_Room_Switch_Test.zip
The test project is made with GMS2 v2.2.1.375 Runtime v2.2.1.291. It is just two rooms, one object, and one sprite. room0 is a persistent room. room1 is not persistent. The object is in both rooms and switches rooms per keyboard_check_pressed. Space bar is used to switch rooms.
When you switch from room 0 to room 1 (from a persistent room to a non-persistent room) there is no increase (however, the debugger shows a slight increase). But going the other way from room 1 to room 0 (a non-persistent room to a persistent room), there is a 152k increase to memory.
I checked it with both rooms NOT persistent resulting with no more memory increase.
I tried it with both rooms persistent and the 152k increase was with every room change.
It would seem that persistent rooms have a memory leak when you are switching to them.
I'm using the Windows Task Manager to see the memory increase. The GMS debugger is showing the increase as well, but with slightly different numbers.
Am I correct calling this a memory leak? Or is it normal for games to consume a small amount of memory while being played?