08.05.2017, 14:07
I never really considered this to be a problem, (as I am trying my best to write clean and optimized code) - but whatever i did in my new update (and whenever there are players on) causes massive ram usage. in 24 hours it consumes about 40% of 2gb ram on a VPS. - The ram usage drops back down to 8-10% when I restart the server, and slowly increases by time and by amount of players.
Anyone who had past experiences with leaks and how to avoid it? Which code could be causing slow build-ups like this, any way to detect it, and what is not recommended doing? I read a bit on the forums, but most replies are "do not blabalbalal" and it's completely nonsense - either way made by total newbies or guys who doesn't know what a memory leak is. So I decided to put a new topic here.
(For example: do not use OnPlayerUpdate() at all. - like come on, it matters which code you got there)
and the "new update " would mean a version update consisting of several upgraded and added systems, so no way to "go back" and see what it could be.
Could "flushing" variables through a command work? Like I choose one system I'd like to try, and i flush all the variables connected to it- and check the ram usage afterwards - Can variables hold that much information?
- I guess not, as memory leaks are just invalid adressed memory that never gets furtherly processed, if I got that correctly.
Any pointers, anything I could read more about - anything that could point me in a direction here would be really useful. I am not 100% familiar on the topic yet, and I hope to be more informed by seeing your replies. I believe I am doing something wrong, but I hope to learn from it if I find what it could be.
Thank you.
Anyone who had past experiences with leaks and how to avoid it? Which code could be causing slow build-ups like this, any way to detect it, and what is not recommended doing? I read a bit on the forums, but most replies are "do not blabalbalal" and it's completely nonsense - either way made by total newbies or guys who doesn't know what a memory leak is. So I decided to put a new topic here.
(For example: do not use OnPlayerUpdate() at all. - like come on, it matters which code you got there)
and the "new update " would mean a version update consisting of several upgraded and added systems, so no way to "go back" and see what it could be.
Could "flushing" variables through a command work? Like I choose one system I'd like to try, and i flush all the variables connected to it- and check the ram usage afterwards - Can variables hold that much information?
- I guess not, as memory leaks are just invalid adressed memory that never gets furtherly processed, if I got that correctly.
Any pointers, anything I could read more about - anything that could point me in a direction here would be really useful. I am not 100% familiar on the topic yet, and I hope to be more informed by seeing your replies. I believe I am doing something wrong, but I hope to learn from it if I find what it could be.
Thank you.