Memory Leak from Destroyed Objects/Models

Hello all,

Recently, my game’s servers have been crashing due to the server hitting the 6.25 GB limit in server memory. I was concerned there may have been a possible memory leak with this, so I decided to test things into my own hands. When viewing active servers’ memory, I realized that (as usual) server memory increases when players spawn cars. I wasn’t exactly concerned with this itself, but what does concern me is the fact that the server memory does not go down when the car is destroyed. This seems like a ROBLOX internal issue, but if it isn’t (and it’s a me issue), I’d love to hear any feedback.

And yes, I understand the server memory is pretty large even on server startup, but one of the goals for the game is make an immersive, realistic map, so unfortunately there isn’t any way around it (if you have tips let me know though!)

Here is a Google Sheet of my findings:

“Normal” column is when the server is first started up, and the rest of the columns are self-explanatory.

Here is a video demonstration of this issue:

As you can see, I spawn in 128 cars and destroy them. One can expect the memory to decrease back to normal when they are destroyed, but that is not the case.

I understand that spawning 128 cars all at once may not be the best test (considering the servers are max at 30 players), but it does simulate what can happen over time during a server’s lifespan.

Let me know if you have any thoughts on this and any workarounds in the mean time.

EDIT:
Here is a place file where you can test this for yourself!
MemLeak.rbxl (5.7 MB)

17 Likes

We’ve filed a ticket into our internal database for this issue and will start investigating, we will update you when we have further information.

Thanks for flagging!

3 Likes

Adding onto my findings:

I have found that when the cars are deleted, the individual memory tags go down, but not the total server memory. Since the server crashes when the total server memory passes 6.25 GB, I reasonably assume that it’s because the server memory total didn’t go down like that tags did. So maybe the total memory memory doesn’t account for the reduction of the individual tags?

I webhook every time a server (near) crashes. Here, you can see all the memory tags’ values before the server crashes. It seems like “Internal” is being used up a lot. Could this cause the total server memory to not go down when the cars are deleted? When the cars are deleted, the individual memory tag values go down, but the total memory tag doesn’t. Maybe something internal is forgotten to be cleaned up?


4 Likes

Other Thread, with more information and a testing baseplate:

Is there any information on this? We still are experiencing this issue.

4 Likes

Hey there, it’s been 3 months, and this issue still occurs. I just tested it and the total server memory count does not go down when the vehicles are destroyed. This is tested in the testing baseplate I have attached below. This seems to be a serious issue in the long-run of server uptime, so having this fixed would help a ton of developers’ games.

MemLeak.rbxl (5.7 MB)

1 Like

For me, the memory went back to normal after about 15 seconds.

You could also check the new “LuauHeap” category in the Developer Console to check if any of your scripts are causing a memory leak, because scripts are seemingly a big contributor (when I tested it, in total, about 1 gigabyte is going to scripts with the LuaHeap and Scripts subcategory under PlaceMemory in the normal Memory tab of the Developer Console).

Same issue with my game, megarepliactedinstance only goes down when the user that owned the vehicles leaves the game.

Yes. I’ve also checked the LuauHeap after my tests within my game, and nothing indicated such memory dedicated to vehicles.

I will update on this with the LuauHeap feature soon.

We checked again and only found a new memory leak related to Editable Meshes Beta feature in Studio.
You can disable that in the Beta Features menu.

Without editable meshes, I don’t see an increase of memory when cars are repeatedly spawned and destroyed.

1 Like

I was testing it the other day and I received the same results. Seem like it was fixed. In that case, what could be the issue in terms of my game? Is it because I still hold a variable reference to it when it’s destroyed? What about references in scripts parented to the car model!

1 Like

Is it true that the max ram doubles from 6 gb to 12+ gb if you set the main place to 100 players or more and that also benefits the other linked places even if they have lower than 100 max players?

@NotRapidV I just checked again and can’t reproduce the memory leak. I’m closing the issue as not reproducible. From the discussion if seems others are saying the same. If you have more problems please reach back out.

1 Like

I’m facing a similar issue currently.

2 Likes