Massive PhysicsPart memory leak results in server crashes

We are having identical serious memory leak issues over time which appear spread out over UntrackedMemory, PlaceMemory and CoreMemory at Pinewood Computer Core, a large game with vehicles, trains and parts that are damaged or explode, and regenerate throughout the facility.

This issue started happening around the same time as this thread and server memory could reach and exceed 5 GB after only 2 hours runtime! This is a new problem we’ve never had before which seems to have appeared without any game updates. I look forward to any updates on this thread as it seems to be our problem as well.

19 Likes

I can confirm this is still an issue as of today, with servers crashing after total server memory reaches a high enough threshold over time. The amount of memory stored seems to vary by server, there is a chance it may be correlated to what happens with physics objects in game being removed and respawned as well as having many constraints, such as the trains and vehicles.

Here’s how much memory a server from Pinewood Computer Core accumulates after a few hours, we can’t work out where its coming from.

10 Likes

Edit: I’ve found the culprit and was not completely related to this.

Sorry!

1 Like


Ah

Any word on this? I am experiencing the exact same scenario, constant physics parts climb in server memory with vehicles that contain constraints regenerating. Servers are unusable after persisting for 3+ hours.

1 Like

Issue persists for me.
My topic also listed here.`

1 Like

After 1 year , this Memory Leak is still not patched

2 Likes

I hope this issue will be fixed soon

Same this is just really disheartening to still have this be a current issue a year later…

4 Likes

This is one of the bugs in the engine that won’t allow us to go beyond what’s possible in ROBLOX due to the possible high memory usage even higher than games created in Unreal Engine; one solution that could potentially work is to make these part Instances to become a ModuleScript and loaded only when needed.

Why does storing parts in ReplicatedStorage increases PhysicsPart and not ServerStorage?
One thing I’ve noticed is when they’re unstored in ReplicatedStorage or workspace in the server is that it decreases PhysicsPart by almost zero.

When part instances is created purely by the client, then it’ll never increase PhysicsPart. But if we tried to clone a part instances in the client from ReplicatedStorage, then deletes it in the server - that part will still remain to have PhysicsPart memory. If only ReplicatedStorage does not increase PhysicsPart then this could solve a lot of problems.

3 Likes

What proves me right here? This is the proof:

Assets used here are called ‘Customization’ and ‘Muscles’ folder, they have CanCollide to false, Massless to false and I’ve taken measure for everything that could possibly affect PhysicsPart.

This video adds in both Customization folder and Muscles folder; which were assets requested from ServerStorage and was just re-parented to ReplicatedStorage. [SERVER]

This video uses a custom ‘ModuleScript’ to load it on client-only inside the ReplicatedStorage.

I cannot send the file in public but if any roblox staffs want to request it, please DM me.

2 Likes

Bump why is there no fix for this?

3 Likes

Bump. PhysicsParts has been very high in my game, never dropping below 1,000 MB. We have a pretty large and detailed map, but we frequently use unions and meshes. Anchored parts are occasionally inserted into Workspace from the server for ability effects. All parts inserted from the server have CanCollide, CanQuery, and CanTouch all turned off (if that makes a difference at all) and are all cleared correctly.

2 Likes

Gonna bump this again. I’m not sure if it’s an issue on Roblox’s end or if I’m doing something wrong. Either way, I’d like some type of response because PhysicsParts is taking by far the most memory in my experience. Does anyone know how to reduce the memory cost?

1 Like

Hey, I know it’s been two years, but I may have found the cause for the memory leak.

It seems that when destroying a Weld, Roblox does not actually remove its Part0 and Part1 references. This could potentially be the case for instances such as Beams and Trails, where attachments are referenced in Attachment0 and Attachment1.

I modified the demo to iterate through the object’s descendants, and remove any Part0 and Part1 reference and then disable the weld, and it seems like that fixes the memory leak.

Hopefully this is useful for patching it in-engine… would help out as I believe a lot of games are afflicted by this without knowing how to fix it!

for i, v in ipairs(Clone:GetDescendants()) do
				if v:IsA("WeldConstraint") then
					v.Part0 = nil
					v.Part1 = nil
					v.Enabled = false
				end
			end
18 Likes

Amazing find! Is this necessary to do with regular Welds (not WeldConstraints) as well?

2 Likes

Hi, it seems like this affects all instances that reference other instances, such as ObjectValues, Beams, Trails, Welds, Motor6Ds, etc.

4 Likes

Insane. Thank you so much for discovering and sharing this, you’re genuinely a life saver. My experience has a lot of welds frequently being added and destroyed, so this is a major impact on the server memory usage for me.
I suggest you make another bug report about this to try to get the attention of Roblox engineers.

1 Like

Has this been fixed internally? I personally tested this in studio but I haven’t seen any immediate change even with the fix, but maybe it was because I was testing in studio and in-game.

Bump. Have been experiencing PhysicsPart being above 2.5g+ at certain times.

Game has lots of car spawning and deleting.

1 Like