Description

There appears to be a memory leak when sculpting landscapes using the sculpt tools on a landscape with a material applied.

Notes

User left this comment:

I tracked it down to the UCookOnTheFlyServer::TickPrecacheObjectsForPlatforms function, which seems to cache landscape textures, but never releases the old ones.

Steps to reproduce are simple: Create a new landscape with any size, assign the Material'/Engine/Tutorial/Landscape/TutorialAssets/Landscape_Material.Landscape_Material' (or any other, really, but with this one it works reliably) to it and try to sculpt it. You will get tons of "LogTexture:Display: Building textures: Texture2D_XXX (BGRA8)" messages in the output log.

What I noticed: Not all landscape materials seem to trigger this caching, but I haven't found which exactly is the problem with those that trigger it.

While unable to reproduce the log messages, the memory increase did occur rapidly and did not reduce once the sculpt tool was no longer in use.

Steps to Reproduce
  1. Open Editor (any project)
  2. Modes>Landscape Mode
  3. In Content Browser>View Options>Show Engine Content (true)
  4. In Landscape Mode>Landscape Material>Landscape_Material (located in Material'/Engine/Tutorial/Landscape/TutorialAssets/Landscape_Material.Landscape_Material)
  5. Create landscape
  6. RMB windows toolbar>Task Manager>Processes>UE4Editor.exe - place this on second monitor to be able to watch values
  7. In Landscape mode, begin sculpting landscape using the sculpt tool. For best results, increase size of sculpt brush.

Results

Memory use increases rapidly. After stopping sculpting, memory use does not return to current use. Each use of the sculpt brush progressively increases amount of memory used with no significant loss of memory use when sculpt brush is not in use.

Expected

Memory use increases until sculpt brush is no longer in use, at which point the memory in use drops down again.

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

17
Login to Vote

Won't Fix
CreatedAug 24, 2016
ResolvedFeb 23, 2021
UpdatedJul 20, 2021