Create a TerrainRegion or two, then repeatedly call Terrain:Clear() followed by Terrain:PasteRegion() providing a new clone of the TerrainRegion for each PasteRegion call. The game must be running for this to be reproduced, so if this is being tested in Studio you must hit Play or Start Server.
This uncopylocked Experience has this issue, and any destroyed TerrainRegions won’t be garbage collected if they have ever been fed to PasteRegion.
This uncopylocked Experience is a modified version where the TerrainRegion is cloned before it is fed to PasteRegion. This causes a direct memory leak of about 300 megabytes every time a TerrainRegion is cloned and pasted.
Expected Behavior
Terrain.PasteRegion should release the TerrainRegion for garbage collection.
Actual Behavior
Terrain.PasteRegion keeps the TerrainRegion (or the data from it) active in memory, even if Terrain.Clear is called.
Issue Area: Engine Issue Type: Performance Impact: High Frequency: Constantly Date First Experienced: 2023-01-08 00:01:00 (-07:00)
Is there any update on this? My game Airship Assault [BETA] - Roblox experiences crashes after only 7 hours, with memory spiking up the 6GB on the server. The game uses lots of large terrain maps and cycles between them, is it possible to check if maybe issues with terrain are causing our server instances to crash?
@JarodOfOrbiter can you please post a simplified placefile that with exact steps to reproduce the problem?
Looking at the code in Terrain:PasteRegion() I don’t see anything that would hold a reference. There’s probably something more complex going on, and I’d need a clear repro case to track this down. Thanks!
This issue is still occuring. We added a new Terrain map to our map rotation on 9/23 and it shot up the server memory massively. This shouldn’t be happening because the Terrain clears upon the round ending. There is definitely something going on causing Roblox to hold onto voxel memory for longer than needed and not properly collapse/cleanup voxels when Terrain is cleared.
Hi @JarodOfOrbiter and @heedicalking, is this issue still happening on your ends? If yes, would it be possible to provide @hyperhumanist with a simplified repro test placefile please?
We are not able to isolate and reproduce this issue internally and would need a placefile or more details on reproduction steps to be able to look into this problem further. I will close this ticket or now, but feel free to re-open this issue whenever you have additional information to help us reproduce the bug.