How to combat memory leaks?

Awhile testing my game with my friend, the ping has been spiking and I know that is because of the memory leaks in my game

What things in my code could be causing the memory leaks? I reviewed some of the stats in the Console and it I saw some things that keep increasing the memory, and I am unsure what causes that.

1 Like

Add breakpoints to likely memory leaking code. Click on the number next to the line of code to pause the game and inspect it when the code reaches there.

1 Like

Disconnect any unused functions and check if there’s any unnecessary loops

1 Like

Is it a good idea to like find scripts that use memory and have connections and loops, then add the disconnect stuff to those scripts?

Block comment and test anything suspicious if necessary and go from there

Can you elaborate?

30charlimitawawawa

--[[
block comment anything you think might be causing issues
]]--
1 Like

pressing control+/ (cmd+/ on mac) will take any code and will comment everything you selected

print("hi")
while true do
   print("bye")
end

to

--print("hi")
--while true do
--   print("bye")
--end