TerrainPhysics memory leak

I am making a procedurally generated smooth terrain world. As the player moves through the world, more terrain gets generated. The terrain is generated by using Terrain:FillBlock(TerrainCFrame, Vector3.new(8, 8, 8), "Grass"). The terrain behind the player gets unloaded by using Terrain:FillRegion(TerrainRegion, 4, "Air") in 64x64 stud chunks. This clears TerrainVoxels but TerrainPhysics doesn’t get cleared. After a few minutes this takes up hundreds of MB of memory and will probably crash after playing for a long time

If you need a place to repro, please dm me and I’ll show you the game it’s happening in

5 Likes

If you could DM me a place, I have a fix coming out in January that SHOULD resolve this. But I would like to verify with your place.

4 Likes

Hey, I just enabled something that should properly clean up physics for deleted Terrain. Its a bit conservative, so if you spawn a large chunk, and delete half the volume sparsely, it may not reduce the memory footprint, but if you do a large clean deletion you should be able to get the memory back.

Can you verify if the problem you described still happens? (Repro will still happen in Studio since Studio still hasn’t been patched from 413 to 414).

3 Likes

Amazing to see Roblox Staff hold their word guaranteeing a fix. Amazing work Khanovich.

This has also been a major factor for my games alike but seem to have fixed itself.

Have a good one!

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