4.9 Memory Leak ViewState and Navigation

Hi,

I collected memory data for a single game session that loads a level and unloads it (unloads it by loading a different empty level) and running memreport -full every time the level is loaded. After repeating this 30 times we saw that even though the number of actors, game objects, materials, meshes, etc, remains constant, the some memory stats continue to climb.

Comparing the first memreport and the last one we found that even though almost everything remains the same, there were large differences in these stats:

Before:

LogMemory: Platform Memory Stats for WindowsNoEditor

LogMemory: Process Physical Memory: 1412.34 MB used, 1426.30 MB peak

LogMemory: Process Virtual Memory: 1458.97 MB used, 1537.60 MB peak

LogMemory: Physical Memory: 11549.00 MB used, 32727.27 MB total

LogMemory: Virtual Memory: 1870.45 MB used, 8388608.00 MB total

LogMemory: 481876 - ViewState memory - STAT_ViewStateMemory - STATGROUP_SceneMemory - STATCAT_Advanced

LogMemory: 6105436 - Navigation Memory - STAT_NavigationMemory - STATGROUP_Memory - STATCAT_Advanced

After:

LogMemory: Platform Memory Stats for WindowsNoEditor

LogMemory: Process Physical Memory: 1466.21 MB used, 1500.75 MB peak

LogMemory: Process Virtual Memory: 1505.86 MB used, 1542.03 MB peak

LogMemory: Physical Memory: 11785.49 MB used, 32727.27 MB total

LogMemory: Virtual Memory: 1904.60 MB used, 8388608.00 MB total

LogMemory: 1244156 - ViewState memory - STAT_ViewStateMemory - STATGROUP_SceneMemory - STATCAT_Advanced

LogMemory: 7493916 - Navigation Memory - STAT_NavigationMemory - STATGROUP_Memory - STATCAT_Advanced

Are there any known issues that would explain this? What areas of the engine should I look into in order to find what is causing these leaks?
There is nowhere in our code where we allocate memory for anything other than an actor or game object.

Thanks,

Franco

Hello TooManyCrashes,

Can I assume that these logs were taken while running in PIE? If so, can you try running in a Standalone Game to see if the same issue occurs?

Hi ,

No, that is not correct. These logs were taken from a standalone build.

LogMemory: Platform Memory Stats for WindowsNoEditor

If taken from the editor I would definitely not have correct values.

Franco

Ah I should’ve noticed. Thank you for clarifying that. I set up a reproduction case using the Third Person Template and just switching out to a blank level and then back every couple seconds. It seems to be increasing for me as well. As such, I’ve placed a bug report in for the issue. For your reference, the bug number is UE-22742. I’ll let you know of any updates that are made.

Have a nice day!

Thanks a lot !

Franco

Hello TooManyCrashes,

Just leaving the message here to let you know that this issue has been fixed internally and will be coming in a future release.

A fix has gone in for this issue now and was just put into the Master branch. This means that it is now available on Github if you would like to apply the changes to your source built engine if you’re using it. You can find the fix here: .com/EpicGames/UnrealEngine/commit/9bb3cb533a6f10b65866088d34653657c365b01a

Please be aware that this fix is lumped in with multiple others so be sure to read through the description to ensure that you want to use this fix.