Description

GDelayTrimMemoryDuringMapLoadMode is a CVar that controls whether a garbage collection should take place during map change after unloading the previous map and before loading the new one. By default a GC pass always takes place. Other settings are available to skip the GC.

Skipping the GC is beneficial to load time if the two maps share dependencies - for example on the same assets. Otherwise, the GC can unload assets which then need to be loaded again as part of the next map.

However, when setting GDelayTrimMemoryDuringMapLoadMode to 2 (skip GC between map loads) and then reloading the same map, the engine will crash due to UObject path name collision. So when using that setting, currently you should explicitly avoid reloading the same map. This limitation is not documented.

I'm creating this task so that an engineer can evaluate:

  • Whether to improve the code comments for GDelayTrimMemoryDuringMapLoadMode to warn against loading the same map
  • Whether to update UEngine::LoadMap() so that regardless of setting, when reloading the same map to always call GC (i.e. always call TrimMemory())
Steps to Reproduce
  • Open Unreal Editor
  • Create a map MyMap and save it
  • Start PIE in MyMap
  • Execute this console command to skip GC between map loads: Engine.DelayTrimMemoryDuringMapLoadMode 2
  • Reload the current map via console command: open MyMap
    • Observe: the editor crashes. A packaged game would crash as well.
    • Expected: the editor or game doesn't crash.

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-203424 in the post.

1
Login to Vote

Backlogged
ComponentUE - Gameplay
Affects Versions5.05.15.25.3
CreatedJan 8, 2024
UpdatedJan 24, 2024
View Jira Issue