Haydenmango Posted July 27, 2014 Share Posted July 27, 2014 When I walk on terrain with a Character Controller my memory usage consistently goes up. I tested this by using the Terrain map in the MyGame project with a Character Controller using the FPSplayer.script. I also put a check for memory usage and collectgarbage() in my main App Loop. Further details can be found in the video I made-- https://www.youtube.com/watch?v=Bj0brR8_7eQ&feature=youtu.be Quote Check out my game Rogue Snowboarding- https://haydenmango.itch.io/roguesnowboarding Link to comment Share on other sites More sharing options...
Haydenmango Posted August 3, 2014 Author Share Posted August 3, 2014 Has this been looked at? I would like to know if this is a problem or not so that I can start working on my game again. I can't accurately test my memory usage if this is a bug. Quote Check out my game Rogue Snowboarding- https://haydenmango.itch.io/roguesnowboarding Link to comment Share on other sites More sharing options...
YouGroove Posted August 3, 2014 Share Posted August 3, 2014 IS anyone else having same problem ? Or it is related to your system ? Are you up to date also ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Haydenmango Posted August 3, 2014 Author Share Posted August 3, 2014 It would be nice if someone else could test this to see if they get similar results. I am up to date and am in the beta. Quote Check out my game Rogue Snowboarding- https://haydenmango.itch.io/roguesnowboarding Link to comment Share on other sites More sharing options...
gamecreator Posted August 3, 2014 Share Posted August 3, 2014 Have you seen this post? http://www.leadwerks.com/werkspace/topic/9505-tons-of-memory-leaks-in-leadwerks/#entry71776 Are you able to check if memory gets cleaned up eventually? (I don't know what the "threshold" Josh mentions is.) Quote Link to comment Share on other sites More sharing options...
Haydenmango Posted August 3, 2014 Author Share Posted August 3, 2014 Yes I recall reading that. The memory never gets cleaned up. I've waited a lonnnnnggggg time and it will never go down. By placing collectgarbage() in my main App loop I believe that stops lua from building up memory. If your memory usage continually goes up, even if you call collect(), you probably have a leak. Just don't use that in your normal code. Lua is meant to build memory up and then automatically release it periodically. --Josh Edit--- After testing more I found that when using the same setup but with a csg box instead of terrain the memory usage reaches a limit. Also when using just a camera to move around the memory usage increases if I have a terrain but the memory usage reaches a limit if it is a csg box. Quote Check out my game Rogue Snowboarding- https://haydenmango.itch.io/roguesnowboarding Link to comment Share on other sites More sharing options...
Ma-Shell Posted August 3, 2014 Share Posted August 3, 2014 I guess, this could be because, as you move, more parts of the terrain have to be loaded into memory, so maybe some parts that are not visible in the beginning might get into view and have to be loaded into memory (just guessing here, I have no idea, how the terrain is implemented) and maybe the parts don't get released afterwards since keeping them in memory is cheaper than extracting them all over again (still guessing ). I will test tomorrow, if I can confirm the memory-increase on my machine (with standalone version) as well, but if it is as I guessed, this would be a normal behaviour. P.S.: Did I mention, I was only guessing?^^ 1 Quote Link to comment Share on other sites More sharing options...
Haydenmango Posted August 3, 2014 Author Share Posted August 3, 2014 Yeah that seems like a reasonable cause for the 'issue'. I was starting to come to a similar conclusion myself but you put it into words perfectly. That would be cool if you could do a test, let me know about the results! The terrain in my test map didn't have any textures on it. So I am now wondering if having multiple terrain texture layers could increase the amount of memory allocated... I am guessing yes but then again I am only guessing at this point.... Quote Check out my game Rogue Snowboarding- https://haydenmango.itch.io/roguesnowboarding Link to comment Share on other sites More sharing options...
YouGroove Posted August 3, 2014 Share Posted August 3, 2014 Do you reach some limit memory ? or does memory increases always ? You could make some character automatically running between two points and see how memory increases and see if it reaches a limit or not ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Haydenmango Posted August 3, 2014 Author Share Posted August 3, 2014 You could make some character automatically running between two points and see how memory increases and see if it reaches a limit or not Yes I have done this and it does reach a limit. In theory you could make a character run around the entire terrain and the memory will reach a limit once you have been everywhere. I haven't tested that because it would take forever but I have tested it on a small csg box and after I ran around the entire box the memory usage did reach a limit and I could continue running without the memory increasing. This probably isn't a bug then but it is kind of limiting and makes memory usage testing quite difficult. Quote Check out my game Rogue Snowboarding- https://haydenmango.itch.io/roguesnowboarding Link to comment Share on other sites More sharing options...
Ma-Shell Posted August 4, 2014 Share Posted August 4, 2014 I just tested this and saw, it happened for me as well. Memory keeps increasing for terrain and for csg-box. I didn't wait to see, if there was a limit. I also noticed, this happens, if you just stand at one position and keep jumping (but not, if you don't do anything). Using self.context:DrawStats with the third parameter set to true, you also see the memory usage split into "script memory usage" and just "memory usage", where the latter one is the one, which keeps increasing, so it doesn't seem to be related to that particular script. Quote Link to comment Share on other sites More sharing options...
Haydenmango Posted August 4, 2014 Author Share Posted August 4, 2014 At least it isn't just me. Thanks for testing that out. Using self.context:DrawStats with the third parameter set to true, you also see the memory usage split into "script memory usage" and just "memory usage" !!!!!!!!!!!!!!! I didn't know you could even do that! That changes everything!I also noticed that just the memory usage rises for me too while the script memory usage stays the same. edit-- What do "batches" stand for? I get 6 batches when using my basic testing map but when I use my Hunt for Food map I get anywhere from 50-100ish batches which I am guessing isn't good. haha 1 Quote Check out my game Rogue Snowboarding- https://haydenmango.itch.io/roguesnowboarding Link to comment Share on other sites More sharing options...
Josh Posted August 5, 2014 Share Posted August 5, 2014 I can't produce any leak. Sometimes there are structures in the terrain class that don't get initialized until they come into view, so if you are traveling around the memory may go up a slight bit. However, I don't see anything that looks like runaway memory allocation when I call collectgarbage(collect) each frame. 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...
Haydenmango Posted August 5, 2014 Author Share Posted August 5, 2014 Ok well I have just been using collectgarbage() not collectgarbage(collect). Once I changed that I think I started getting more accurate results. It is good to know that some of the small memory bumps are possibly structures in the terrain class getting initialized and it is not a leak. P.S. Knowing about the third parameter for DrawStats() is really helping me test my other projects! Also, I couldn't find the DrawStats() function in the documentation; did I miss it or is it yet to be created? Quote Check out my game Rogue Snowboarding- https://haydenmango.itch.io/roguesnowboarding Link to comment Share on other sites More sharing options...
Ma-Shell Posted August 5, 2014 Share Posted August 5, 2014 What is the difference between "collectgarbage(collect)" and just "collectgarbage()"? In C++ there is not even an overload of that function that takes a parameter and it isn't documented. P.S. Knowing about the third parameter for DrawStats() is really helping me test my other projects! Also, I couldn't find the DrawStats() function in the documentation; did I miss it or is it yet to be created? You are right, it isn't documented. I found out about it because I usually use C++ for my projects and VisualStudio has the nice Intelli-Sense where it told me, there was a third parameter called "extra" that defaulted to "false". Quote Link to comment Share on other sites More sharing options...
Josh Posted August 5, 2014 Share Posted August 5, 2014 http://luatut.com/collectgarbage.html 2 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.