Deciphering MicroProfiler/Memory Usage

Hi all,

My game is currently using 1546 MB of Client Memory Usage, just chilling out. I’m told this is not ideal. I’ve ran the MicroProfiler, and I’m having a difficult time deciphering what each bar actually means. I see things labeled “stepLegacy”, “Worker : : runJob”, “gameStepped”, “physicsStepped”, etc. that are all long bars, and I assume translate to something I’ve done, but unsure what. I’ve searched around and not seeing definitions to pinpoint to things from these terms, although its possible I’ve overlooked a source. :slight_smile:

I went through the code disabling things that Moved/Spun on their own - spinning coins - I removed all NPCs from the game briefly, but that had a negligible effect on the amount of memory being used.

Thoughts on how I can pinpoint the problem better?
Game Link:

MicroProfiler download:log_3E8F0_microprofile_20190911-002847.html (282.2 KB)

Any help is much appreciated. Thanks!

4 Likes

do you have streaming enabled on and also here is a linked to a video made by roblox on understanding the microprofiler: Documentation - Roblox Creator Hub

1 Like

Thanks for the response. I do not have streaming enabled. I’ve watched the three videos. :slight_smile: they’re a nice over view, but I’m hoping there’s actual definitions out there for the terms in the microprofiler that would help me narrow down the problem areas.
(Sorry, typing on phone.)

and btw i just checked out your game and its kinda laggy on my laptop and other larger games dont lag at all, i noticed that your part count is quite large over 246,000. Also, you should look into using mesh parts because they are way more efficient given the triangle count is not too extensive, and also they use instancing.

1 Like

for example for some of your roofs you use tons of cylinders for each one, when instead you could use one mesh, and the lag can also be as a result of inefficient scripting and overworking the server for things that can be done on individual clients

1 Like

You dont have to only use the microprofiler btw, you can also use the performance stats, this can be enabled under settign(press Esc - go to settings - and enable performance stats), also to review your script performance go to view tab under roblox studio and enable script performance (i think this is the navigation for this not sure.

2 Likes

Don’t worry about having overlooked a source. There’s a crippling lack of information on the MicroProfiler for which two documentation requests exist for.

A lot of the labels seem to be for internal processes, so you just have to use your best guesses for understanding what the bars mean right now. For example, worker::RunJob pertains to loops in your game (?) and physicsStepped refers to a step (see: RunService.Stepped) for physics.

3 Likes

Am I reading this correctly, that some of these scripts are pinging 21x per second?

That script pinging 21.0/s is just this:

local plr = game.Players.LocalPlayer
local kills = plr.leaderstats.Kills

while true do
wait()
script.Parent.Text = "KOs: ".. kills.Value
end

I assume that converting these to update via RemoteEvent would be a better option? Would doing so knock out how much memory is being drained? This particular file is running at nearly 8000MB, and its a essentially the same scripts as the Lobby, and the houses, but not any of the terrain or the large size objects.

Thank you for all your responses, I’ll be looking at converting some of the models to meshes. I thought meshes took up more space though? I ran into problems with changing parts of the houses into meshes from parts, it prevented me from allowing players to change the colors from the house customization menu…but I’ll sort that out if it means reducing the memory drain! :slight_smile:

This is both good and depressing to know! :smiley: okay, if worker::RunJob refers to my while true do loops, that gives me a place to start. By ‘step’ do you mean players/NPCs/humanoids moving around? That’s worrisome. :smiley:

Constantly updating the text is probably not a good idea, a better approach to updating your text would be to use GetPropertyChangedSignal

Here is an example:

local player = game:GetService("Players").LocalPlayer;
local kills = player:WaitForChild("leaderstats"):WaitForChild("Kills");

kills:GetPropertyChangedSignal("Value"):connect(function()
	script.Parent.Text = "KOs: ".. kills.Value
end)
1 Like

Steps just refer to frames in your game. A frame typically consists of a RenderStep, Step and Heartbeat (following the RunService events that allow you to bind functions based on these signals) “benchmark” of sorts. Physics falls in stepped. There’s a couple of threads existing that mention a physics step.

There’s something absolutely basic and crucial to understand while using the MicroProfiler. When you open it, you will see alternating coloured vertical bars and coloured horizontal bars running across them. The verticals represent a frame and the horizontal represents the processes. The absolute fundamental thing to understand is that the longer the bar, the more impact it has on your game.

Humanoids moving around would fall under an unspecified step, though that’s just speculation. I’m thinking of the Humanoid’s involvement in the physics and rendering pipelines when I assume this.

Thank you for this! I went and updated all of the stat updates with this line of code, seemed to make a little difference. :slight_smile:

I do have a massive amount of parts, many of them were union’d, but I’m reading that this is bad?

I also did not realize how easy it is to export your object and re-import it as a mesh. I’ll work on converting everything to mesh now. Wow. o_o

Okay, I took one of my houses that was made of 228 parts, and then converted it into 21 meshes. I made a clean game file for each, just a base plate and the house, no scripts no nothing. The game file with the house made of 228 parts was a 34KB game file used 417MB of memory, and the house with 21 meshes was a 98KB game file, and used 475MB of memory.

Pardon my ignorance over what must be a basic question, I don’t understand why these take up such large chunks of memory?

,

they dont roblox itself uses memory to run core scripts and other things, you can check by making a new place with just a baseplate.

Right, but shouldn’t the baseplate with an object made out of 21 meshes take up less memory than the baseplate with an object made out of 228 parts? If my game has too many parts in it, and the trick is to get the part count down by using meshes in order to keep the memory required to run it down, shouldn’t the game with the smaller number of parts take less memory?

The performance stats state from the graphic that the goal is to keep it to 200MB of memory usage, but Roblox’s own internal scripts double that from the start? That doesn’t make sense.

Parts are inexpensive to the engine and considered absolute primitives. Meshes are assets. Three pipelines meshes can fall under are physics, rendering and assets (in terms of loading, caching, so on). Meshes by nature would take up a larger space in memory than a regular unmeshed primitive would.

Meshes reduce your part count but at the cost of spending more memory to get them in. It’s a common misconception that less means better: that’s a “yes but actually no” scenario. 228 parts is nothing to memory or performance depending on how they’re laid out and especially if they’re static.

1 Like

Excellent, this is good to know! Thanks!
I’m trying to figure out how to get my game’s memory usage down from 1600+MB, The game has 264,000 parts in it, the great majority of which, if not all of them, are anchored. I went through and edited, or disabled the while true do loops, still not getting the memory usage down.

As its been mentioned, and I confirmed myself too after seeing the performance stats tool, the front page games all have low memory usage, despite being very large games in some cases. I’d like to get more memory efficient myself here too. :slight_smile:

More than anything scripts are probably hogging memory. You can explore this further with the Developer Console which provides detailed analysis of your games, while Performance Stats and the MicroProfiler are more for performance and don’t provide as in-depth a review of your game.

264k parts is something to memory but very little.

I’ll be going through every single script now, but I don’t understand how a game with nothing but a mesh piece in it, no scripts added, can take up so much memory.

This one, all I added was a mesh house, is taking 768MB of memory. How in the world are we suppose to get the memory usage down to the recommended 200MB when there’s nothing running? Or better yet, how can a game like MeepCity run with under 400MB of memory being used? To check, I tried with Streaming enabled disabled and then enabled:
Streaming Disabled - 758MB of Memory:


Streaming Enabled - 761MB of memory:

1 Like