Clearing errors to save client memory usage?

I have been searching for a memory leak in my game since I noticed people that keep on playing complain about their memory usage. After further investigation, I found that the main cause of this was the errors that are being shown in the clients developer console. As there are more errors the client memory usage goes up.

Is this due to the logging in the dev console, a result of the errors themselves, or possibly both?

Is there a way to clear the console as a cautionary measure in case another one of these cases Iā€™m not aware of occurs?

5 Likes

Can we see the errors? Iā€™m not sure, but I would assume printing out errors would not take that much memory.

1 Like

Itā€™s just a simple could not find part in tool error that is in a 3 line script with a MouseButton1Down function that fires an event that can cause the error.

Try fixing the error and see if that helps with the memory.

This. Iā€™m not sure why your first instinct is to hide the errors instead of actually fixing them.

1 Like

My first instinct was to fix them, but I still wanted to know if hiding the errors is a possibility just to be safe.

If the error is happening every single time the player clicks, then perhaps that could cause lag or something. I would say itā€™s better to fix it, as it doesnā€™t seem like a hard fix.

You can wrap it in a pcall:

local Success, ErrorMessage = pcall(function()
    -- Code here
end)

But, ultimately, you would want to debug that error because errors mean that you are doing something wrong and somethings will not work as planned.

Never!

You should never ā€œhide errorsā€, as they will just come back in much greater force and cause you even bigger pain. (This also applies to ā€˜real lifeā€™.)

Always be on the look out for warnings and errors that may occur in your game. Study and understand why they happen, and fix them as soon as possible, otherwise you will just end up with a broken mess that can be extremely difficult to repair.