Search the Community
Showing results for tags 'Garbage Collector'.
-
I have been reading a lot about Lua and specifically the garbage collector recently and learned a few things. Such as - source- http://www.lua.org/manual/5.1/manual.html I have been testing my game for memory issues for weeks now and I am starting to think that the garbage collector just isn't fast enough to keep up with the amount of things I have going on. I noticed that since my memory usage rises to quick that the collector waits for my total memory to double before starting the next cycle and things start to get out of hand from there. I know that in most cases the garbage collector should be able to handle by itself but in my case it is not. I do not have any memory leaks in my code. I know this because if I run the garbage collector every frame my memory usage stays consistent. So could it be a better option to control the Lua Garbage Collector manually in my case? Edit ---- I have tested using collectgarbage('setpause',100) in my App Start() function. My game lasted about 2 hours longer than usual!! I normally test my games memory usage by going into release mode and standing completely still until my game crashes(It used to crash after about an hour); this time, well after I reached my normal 'crash point' I started running around doing crazy things to see if I would run out of memory but my game crashed due to an unknown error (I wasn't in debug mode) which I believe to be an issue in my script(not memory related)!!! I found multiple bugs I haven't noticed in my game before as well which I will fix and then I will test this more thoroughly. Also when tested in debug mode I noticed that my memory usage stayed consistent when before it used to constantly increase!