Reproduction Steps
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.
Relevant thread where someone experienced this issue.
This uncopylocked Experience has this issue, and any destroyed TerrainRegion
s 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)