Unfreed Memory After Studio Session Exit

Reproduction Steps

Recently found out that Studio is not freeing memory when you leave a place studio session on Mac (M1). I can’t tell if this is by design (I.e caching files) or if this is some sort of memory leak. So, just thought I’d post it here. Below are a series of screenshots that I took. I also included the place file that I used. Seems to be extremely noticeable, given you search for it, with heavy-load places.

Intel is x86_64 instruction set. Meaning, it’s running under Rosetta 2. Apple is ARM instruction set and is considered native. The one item highlighted is the app.

I went to the url and clicked edit place. It popped open a Roblox Studio session. I put my camera / viewport in the default place when it opened. It was in the middle of everything.

At the same time, I have Discord, VSCode, Activity Monitor, Messages, Safari and notes active. All of these apps are in addition to Roblox Studio being active in the same space. On safari, I have 13 tabs open. The tabs are as follows: Youtube, Google Sheets, Quora, two Github pages, two Rust-lang pages, reddit, Roblox devforum, a general google search, and three Roblox website tabs.

When I saved the place file to my desktop and went back to the general dashboard. Note that this is only the dashboard and I am not in the same place file.

The only way to free up memory is to quit the app entirely. So if you were to open two different place files with the same amount of meshes, textures, etc, you would be doubling the RAM that I have shown here.

Memory on M1 works a little differently but, should be the same across most operating systems.

Notice how, Roblox Studio, despite not being in a game is using 3.06 GB of memory as a byproduct from the previous session. openAndSavePanelService is still an open process despite no longer being used. Essentially, being a zombie process. Before screenshotted, I left it open for around 20 minutes in the same idle state.

Additional statistics for those who are curious.


Expected Behavior

Not to have excessive memory consumption when the app is idle on the general dashboard screen.

Actual Behavior

Visual aids are provided above.

Workaround

Force quit studio if not in use.

Issue Area: Engine
Issue Type: Performance
Impact: High
Frequency: Constantly
Date Last Experienced: 2022-08-29 00:08:00 (-04:00)

2 Likes

Thanks for the report! We’ll follow up when we have an update for you.

2 Likes

This was just routed to me now, and I know this is an old bug but thought I’d leave a reply in case someone else sees this or has the same issue.

In general MacOS isn’t going to free up virtual memory allocated to the process. Some pages will get returned, but generally once the process takes memory into its allocators its pretty reluctant to give them back. The behavior you should see is that after opening a place (and especially after running the place once opened) memory will reach peak consumption. If one closes the place and returns to the start page, then opens another, what you should not see is continued memory growth (unless the second place is a lot larger or something). Opening the same place again will not increase peak memory consumption (and if it does, that is a bug).

There’s not a ton we can do about total memory usage in this manner, but if its a problem the best thing to do is use the “Open” or “New” menu items which will start a new process. You can close the other instance and ensure that all memory is freed back to the OS. (This is exactly why programs like Chrome use the process model they do - it isolates crashes but also allows memory to be truly freed when a page is closed).

1 Like

Hi, thanks for the response. That makes sense as you can’t control manually paging out memory in user space nor would that be a good idea in the first place. Manual intervention is not a good thing in this case. Still surprised that macOS app is running through Rosetta instead of natively.