Memory exceeds 1GB in my game

Hello, I am scripting a game where you pass a bomb around a circle. I am very inexperienced in memory and how to optimize my scripts for the best memory usage. But my game runs on 22 events majority being remote events, I am using 17 module scripts for the client (their ui, etc). I am using 3 module scripts for the main function of the game. I dont have that many touched events.

Honestly I’m just really confused why the memory is so high. Right now it sits at an average if 1 GB of memory and if anyone could help me lower it down to around 500-700MB that would be awesome.

Is it using 1 GB of memory on the computer or a mobile device?

If it’s on the computer, then it’s already really good. Usually, you only have to consider 2 GB + memory usage as “high”.

If it’s on mobile devices, then that’s insanely high. You need to get it down to at most 500.

There are also several ways to decrease memory, for example, disconnecting useless events, decreasing the number of total scripts, decreasing the number of unique meshes, and so on.

Please provide a bit more in-depth detail on your issue.

1 Like

Well when I join the game and open the dev console it tells me that I am using 1.05GB of memory, but if I open the performance page for the game it says its just below 2gb. On her it also says mobile devices are using around 0.8-0.9 GB.

Like @iicloudsforeveriii has said. You need to optimise your scripts more. Any needless loops, pointless variable declaration/connections not being used correctly and other things like they’ve said.

You can see exactly what is taking up the memory by looking at the heap in devconsole

“The Luau heap tool allows you to create snapshots on the current allocation of heap memory, which refers to the memory allocation to Luau scripts for storing variables, tables, functions, and other runtime data structures. This tool provides various memory allocation views to help you identify memory allocation and issues from different perspectives, such as object types and engine classes. It also allows you to create multiple snapshots to compare differences in memory usage over time.” - Memory usage | Documentation - Roblox Creator Hub

3 Likes

I see, you can use the Script Performance screen accessible in the View tab to see what scripts are being used and how much and at what rate they are being used.

1 Like

You can look at the memory section and you can then see how much memory that script is using. You can also get a small chart too if you click on it I believe. It is a very useful tool.

1 Like

Alright, this helps so much. Thankyou for the help as I was very inexperienced and the forums werent much of help.

No worries! Happy developing!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.