How to reduce client memory?

Hi developers,
I have had an Italian roleplay game for some time, but I have always encountered problems with lag and excessive memory use. Today I went into the game and took screenshots of everything that is taking up memory and below you see what is taking up. Memory usage always keeps increasing until the server crashes after a while. I don’t understand anything about these things, if someone can explain they would be able to give me a hand I would be happy.

Memory constantly increasing (a memory leak) probably means you have some scripts that are running in infinite loops using up more and more memory.

Could you investigate your scripts and see if they contain infinite loops?

Maybe a malicious script was inserted into your game through a free model.

hello, thanks for the advice, the problem is that I don’t know where to start since there are hundreds of scripts counting those of the machines. One loop that certainly exists is that of constantly updating money stats.

I would suggest looking at the script profiler: ScriptProfiler | Roblox Creator Documentation.

1.) Check the ends of your Server Scripts, if they contain code that you did not write, uninstall any suspicious plugins. You should do that last part whether you find anything or not.

2.) Check for unanchored parts (always good to check), and free model “viruses”.

3.) Disconnect RBXSIgnalConnections if they don’t serve a purpose, furthermore, break loops that aren’t serving any specific purpose.

4.) Avoid setting values repeatedly, for example;

local x=1+1
local bool=false
while task.wait() do
if x==2 then 
else bool=false

Here’s an example of a good loop:

local c=os.clock()
while task.wait() do
if os.clock()-c>=5 then
else continue end

You can also see what scripts exactly are hogging memory and you can eliminate things from there.

Okay, I walked around the map and this is what came out, I don’t understand if it’s good or not and how to locate activated scripts

Hello thank you very much, to check the scripts I have to do it manually or do you have any tips for me? the scripts are really too many


Start here, and look for the script that is performing the worst. Also, consider looking for scripts you didn’t add through that scripts option.

Roblox 04_01_2023 13_02_47
these are the most frequently active scripts and they are all okay

This shows you how much processing power the scripts use, not how much memory they consume. A memory leak doesn’t necessarily use much processing.

There are a few ways you can try to reduce the amount of memory that your Roblox game is using:

  1. Use the Memory Profiler to identify which assets are using the most memory, and try to optimize or remove them if possible.
  2. Use the Model Optimizer to optimize your game’s 3D models and reduce their memory usage.
  3. Avoid using unnecessarily large textures, or use texture compression to reduce their memory footprint.
  4. Avoid using too many large particle effects, or use the Particle Optimizer to reduce their memory usage.
  5. Use the Asset Compactor to reduce the overall size of your game’s asset files.
  6. Use the Network Throttler to limit the amount of data that is transmitted between the server and the client, which can help reduce the amount of memory used by networked objects.

Oh my mistake, it doesn’t show memory usage it shows CPU usage.

Try turning on workspace.StreamingEnabled and see if there’s any improvement.

(If you’re using terrain voxels, this is very good to have on for performance)

Roblox 04_01_2023 12_05_241920×1080 305 KB

Roblox 04_01_2023 12_05_291920×1080 301 KB

Roblox 04_01_2023 12_05_351920×1080 258 KB

Roblox 04_01_2023 12_05_421920×1080 258 KB

Roblox 04_01_2023 12_05_481920×1080 258 KB

Roblox 04_01_2023 12_05_541920×1080 257 KB

Roblox 04_01_2023 12_06_011920×1080 257 KB

Roblox 04_01_2023 12_06_071920×1080 257 KB

Roblox 04_01_2023 12_06_141920×1080 257 KB

Roblox 04_01_2023 12_06_211920×1080 257 KB

Roblox 04_01_2023 12_06_271920×1080 257 KB

Roblox 04_01_2023 12_06_331920×1080 257 KB

Roblox 04_01_2023 12_06_391920×1080 257 KB

Roblox 04_01_2023 12_06_451920×1080 257 KB

Roblox 04_01_2023 12_06_512019×1080 257 KB

Roblox 04_01_2023 12_06_581920×1080 257 KB

Roblox 04_01_2023 12_07_051920×1080 257 KB

Roblox 04_01_2023 12_07_121920×1080 257 KB

Roblox 04_01_2023 12_07_191920×1080 257 KB

Roblox 04_01_2023 12_07_251920×1080 257 KB

Roblox 04_01_2023 12_07_312019×1080 257 KB

Roblox 04_01_2023 12_07_391920×1080 257 KB

Roblox 04_01_2023 12_07_451920×1080 257 KB

Roblox 04_01_2023 12_07_512019