Is lua heap bad? what is it exactly and why does it stay in the server memory
lua heap is caused by not cleaning up connections, instance references, etc.Lua Heap is memory alocations and is bad for the server.
Does lua heap rise then lower if you are cleaning up?
Lua heap would be lower if you cleaned up variables and other things in your script properly.
How does one clean up variables? I’ve never done that before and probably should
lua heap is not “bad”
That’s like saying using a car is bad because it uses gasoline.
What is bad is memory leaks. Which is just when unused items don’t get garbage collected. If you have a lot of memory leaks the server will run out of memory and yoru game will slow down/break.
For the most part GarbageCollection does a good job at cleaning things up when you are done. Whenever a variable is out of scope it will get cleaned up.
There are exceptions which you have to manually worry about though, like event connections.
There are patterns that make it very easy and efficient to clean stuff up like Maid
You could clean up variables by removing variables you don’t use, or if you stored a player in a table and they leave, you should remove them from it to clear the references to that player. also clearing up unused connections like a Character Added Connection to a left player.
Oh, I see. I do most of that stuff I just didn’t know what it was called XD.
I do need to clean up the character added stuff though, Thanks!