gothboiclique Posted March 27, 2021 Share Posted March 27, 2021 Using the default FPS template in LUA, I have noticed an excessive amount of memory being used. In debug mode, standing perfectly still, memory usage continues to increase. There are times where it may fall slightly, but overall, after leaving the default FPS project on the pickup items map, the usage went from ~45 MB to 400MB or so over an hour. Is there any solution to this or is this expected behavior? Also, I believe the issue lies in the FPSController UpdatePhysics function, after deleting the code inside that function, memory usage stays still. It seems the objects like Vec3 are not being cleared from memory but this is just a guess. Quote Link to comment Share on other sites More sharing options...
Josh Posted March 28, 2021 Share Posted March 28, 2021 The way Lua works is it only performs a garbage collection sweep once a certain threshold is reached. To test memory usage you can add a collectgarbage() call in your main loop so it gets collected each frame and run the game in debug mode. (This will result in slower execution speed so it is not recommended to use this all the time.) (In Ultra Engine the game logic is all running on its own thread and has a full 16 milliseconds to execute, so continual garbage collection could be an option to use there without affecting the framerate.) Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
gothboiclique Posted March 28, 2021 Author Share Posted March 28, 2021 17 hours ago, Josh said: The way Lua works is it only performs a garbage collection sweep once a certain threshold is reached. To test memory usage you can add a collectgarbage() call in your main loop so it gets collected each frame and run the game in debug mode. (This will result in slower execution speed so it is not recommended to use this all the time.) (In Ultra Engine the game logic is all running on its own thread and has a full 16 milliseconds to execute, so continual garbage collection could be an option to use there without affecting the framerate.) Yes, however, after leaving the program running for a few hours I got Lua Error: Out of Memory. Also, how can I apply to get access to the Ultra Engine beta? EDIT: I was referring to my own project, my apologies, it's an issue I'm currently solving. Thank you Josh for the response, I am still interested in the beta. Let me know, thanks! Quote Link to comment Share on other sites More sharing options...
Josh Posted March 29, 2021 Share Posted March 29, 2021 Okay, that would indicate you probably do have a memory leak. Can you isolate what is causing it? Try disabling parts of your code until it stops happening, together with the call to collectgarbage() in the main loop. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.