APaperCharacter eating all ram at startup

Paper Character is bugged on 4.10 (works fine on 4.9), when hitting play in the editor, it will hang and start eating ram until you don’t have anymore, and then only it will start playing the game.
Here is a screenshot :

This only happens the first time you “Play” with a Paper Character in the map, consecutive plays will not trigger this issue.
It doesn’t trigger a huge memory usage when using “launch”, however the following error is logged :

LogPlayLevel: UE4Game: [2015.11.24-05.12.54:929][  0]LogOutputDevice:Error:
LogPlayLevel: UE4Game: begin: stack for UATLogOutputDevice:Warning: === Handled error: ===
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: Ensure condition failed: MyNavData [File:D:\BuildFarm\buildmachine_++depot+UE4-Releases+4.10\Engine\Source\Runtime\AIModule\Private\Navigation\PathFollowingComponent.cpp] [Line: 511]
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: Stack:
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!FWindowsPlatformStackWalk::StackWalkAndDump()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!FDebug::EnsureFailed()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!FDebug::OptionallyLogFormattedEnsureMessageReturningFalse()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!UPathFollowingComponent::RecacheNavigationData()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!?ExecuteIfSafe@?$TBaseUObjectMethodDelegateInstance@$0A@VUPathFollowingComponent@@$$A6AXXZ$$V@@UEBA_NXZ()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!?Broadcast@?$TBaseMulticastDelegate@X$$V@@QEBAXXZ()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!UNavigationSystem::OnWorldInitDone()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!UNavigationSystem::InitializeForWorld()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!UEngine::LoadMap()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!UEngine::Browse()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!UGameInstance::StartGameInstance()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!UGameEngine::Init()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!FEngineLoop::Init()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!GuardedMain()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!GuardedMainWrapper()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!WinMain()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!__scrt_common_main_seh()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: KERNEL32.DLL
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: ntdll.dll
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: ntdll.dll
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: [2015.11.24-05.12.54:929][  0]LogOutputDevice:Warning: === Handled error: ===
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: Ensure condition failed: MyNavData [File:D:\BuildFarm\buildmachine_++depot+UE4-Releases+4.10\Engine\Source\Runtime\AIModule\Private\Navigation\PathFollowingComponent.cpp] [Line: 511]
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: Stack:
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!FWindowsPlatformStackWalk::StackWalkAndDump()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!FDebug::EnsureFailed()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!FDebug::OptionallyLogFormattedEnsureMessageReturningFalse()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!UPathFollowingComponent::RecacheNavigationData()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!?ExecuteIfSafe@?$TBaseUObjectMethodDelegateInstance@$0A@VUPathFollowingComponent@@$$A6AXXZ$$V@@UEBA_NXZ()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!?Broadcast@?$TBaseMulticastDelegate@X$$V@@QEBAXXZ()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!UNavigationSystem::OnWorldInitDone()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!UNavigationSystem::InitializeForWorld()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!UEngine::LoadMap()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!UEngine::Browse()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!UGameInstance::StartGameInstance()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!UGameEngine::Init()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!FEngineLoop::Init()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!GuardedMain()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!GuardedMainWrapper()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!WinMain()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: UE4Game.exe!__scrt_common_main_seh()
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: KERNEL32.DLL
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: ntdll.dll
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: ntdll.dll
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: LogOutputDevice:Error:
LogPlayLevel: UE4Game: end: stack for UAT
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: [2015.11.24-05.12.54:929][  0]LogOutputDevice:Error:
LogPlayLevel: UE4Game: end: stack for UATLogWindows:Warning: CreateProc failed (2) ..\..\..\Engine\Binaries/Win64/CrashReportClient.exe  -Unattended -AppName=UE4-MyProject2
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: [2015.11.24-05.12.55:124][  0]LogWindows:Warning: CreateProc failed (2) ..\..\..\Engine\Binaries/Win64/CrashReportClient.exe  -Unattended -AppName=UE4-MyProject2LogInit:Display: Game Engine Initialized.
LogPlayLevel: UE4Game:
LogPlayLevel: UE4Game: [2015.11.24-05.12.55:125][  0]LogInit:Display: Game Engine Initialized.LogWindowsTextInputMethodSystem:Display: IME system now deactivated.
LogPlayLevel: UE4Game:

How to reproduce

  1. Create a new project based on the 2D sidescroller template
  2. Add a Paper Character to the level
  3. Play or Launch

#EDIT

After using VS15 memory profiler, it seems that the following stack is being played a hell lot of times :

Identificateur	Adresse	Type d'objet	Taille (octets)	Module	
 - LoadProcessModules	0x4525821ab0		8 216	UE4Editor-Core.dll
     [Code externe]		null		[Code externe]
     LoadProcessModules		null		UE4Editor-Core.dll
     FWindowsPlatformStackWalk::InitStackWalking		null		UE4Editor-Core.dll
     FWindowsPlatformStackWalk::StackWalkAndDump		null		UE4Editor-Core.dll
     FDebug::EnsureFailed		null		UE4Editor-Core.dll
     FDebug::OptionallyLogFormattedEnsureMessageReturningFalse		null		UE4Editor-Core.dll
     UPathFollowingComponent::RecacheNavigationData		null		UE4Editor-AIModule.dll
     TBaseUObjectMethodDelegateInstance<0,UPathFollowingComponent,void __cdecl(void)>::ExecuteIfSafe		null		UE4Editor-AIModule.dll
     TBaseMulticastDelegate<void>::Broadcast		null		UE4Editor-Engine.dll
     UNavigationSystem::OnWorldInitDone		null		UE4Editor-Engine.dll
     UNavigationSystem::InitializeForWorld		null		UE4Editor-Engine.dll
     UGameInstance::StartPIEGameInstance		null		UE4Editor-Engine.dll
     UEditorEngine::CreatePIEGameInstance		null		UE4Editor-UnrealEd.dll
     UEditorEngine::PlayInEditor		null		UE4Editor-UnrealEd.dll
     UEditorEngine::StartQueuedPlayMapRequest		null		UE4Editor-UnrealEd.dll
     UEditorEngine::Tick		null		UE4Editor-UnrealEd.dll
     UUnrealEdEngine::Tick		null		UE4Editor-UnrealEd.dll
     FEngineLoop::Tick		null		UE4Editor.exe
     GuardedMain		null		UE4Editor.exe
     GuardedMainWrapper		null		UE4Editor.exe
     WinMain		null		UE4Editor.exe
     __scrt_common_main_seh		null		UE4Editor.exe
     [Code externe]		null		[Code externe]

Sadly VS indicates that the allocation is being done in “External Code”.
As you can see from the following screenshot it keeps allocating memory in 8216bytes chunks.

The logged error is a result of using path-following enabled AI controller without any navigation data. I’ll change it to warning soon(ish).

It’s unrelated to the memory consumption issue.

Cheers,

–mieszko

The memory consumption issue is however only triggered when the ensure condition fails. I gave it a try with VS2015 and the DebugGame Editor target. The ensure condition failure triggers a breakpoint, and if we chose to continue, there is no memory leak. However in DebugGame only, the breakpoint will not trigger and the memory leak will appear. It could be a side effect, but it surely is linked to this.
Also, I find it weird to have such error/warnings when simply adding a PaperCharacter on a template project.
Thanks for the prompt answer !

Hello Lectern,

Thank you for reporting this issue. I gave this a try in the 4.10 Binary version and definitely saw results but gave it a try on our latest internal build and it seems like the issue is already resolved. I’ll be keeping an eye out for it just in case, but please be looking for it to be fixed in one of our future releases.

Have a nice day!

I just edited the original post with more information, but it seems that
FWindowsPlatformStackWalk::InitStackWalking is being called in loop because of the ensure fail

If I try the latest git version should I be able to see those changes ? So that I can confirm that it indeed is fixed for me too ?

The Master branch should have these fixes integrated but I can’t guarantee how stable the build will be otherwise. You shouldn’t see this particular issue there however.

Hi : Could you please provide the commit number that fixed this issue? We probably need to manually pull the commit to fix this issue, too.

Unfortunately, due to a new setup we’re using for our internal builds, none of our recent commits have been posted to GitHub so it will be unavailable for now.

If they were available however, I wouldn’t be able to narrow it down as the issue was never actually reported, but seems to be fixed inadvertently somewhere between 4.10 and our latest. This means there aren’t any records of which commit actually made the fix.