Exit code 137 UE5.0.3 Cooking

When cooking I get the following error:

CommandletException: Editor terminated with exit code 137 (signal 9) while running Cook for /home/ubuntu/Azure-Agent/_work/1/s/CesiumDemo.uproject; see log /home/ubuntu/Library/Logs/Unreal Engine/LocalBuildLogs/Cook-2022.10.13-15.30.35.txt
   at AutomationTool.CommandUtils.RunCommandlet(FileReference ProjectName, String UnrealExe, String Commandlet, String Parameters, String& DestLogFile, Int32 ErrorLevel) in /home/ubuntu/UnrealEngine/Engine/Source/Programs/AutomationTool/AutomationUtils/CommandletUtils.cs:line 425
   at AutomationTool.CommandUtils.CookCommandlet(FileReference ProjectName, String UnrealExe, String[] Maps, String[] Dirs, String InternationalizationPreset, String[] CulturesToCook, String TargetPlatform, String Parameters) in /home/ubuntu/UnrealEngine/Engine/Source/Programs/AutomationTool/AutomationUtils/CommandletUtils.cs:line 91
   at AutomationScripts.Project.Cook(ProjectParams Params) in /home/ubuntu/UnrealEngine/Engine/Source/Programs/AutomationTool/Scripts/CookCommand.Automation.cs:line 268Wrapped by AutomationException: Cook failed.
   at AutomationScripts.Project.Cook(ProjectParams Params) in /home/ubuntu/UnrealEngine/Engine/Source/Programs/AutomationTool/Scripts/CookCommand.Automation.cs:line 284
   at BuildCookRun.DoBuildCookRun(ProjectParams Params) in /home/ubuntu/UnrealEngine/Engine/Source/Programs/AutomationTool/Scripts/BuildCookRun.Automation.cs:line 206
   at BuildCookRun.ExecuteBuild() in /home/ubuntu/UnrealEngine/Engine/Source/Programs/AutomationTool/Scripts/BuildCookRun.Automation.cs:line 41
   at AutomationTool.BuildCommand.Execute() in /home/ubuntu/UnrealEngine/Engine/Source/Programs/AutomationTool/AutomationUtils/BuildCommand.cs:line 344
   at AutomationTool.Automation.Execute(List`1 CommandsToExecute, Dictionary`2 Commands) in /home/ubuntu/UnrealEngine/Engine/Source/Programs/AutomationTool/AutomationUtils/Automation.cs:line 254
   at AutomationTool.Automation.Process(ParsedCommandLine AutomationToolCommandLine, StartupTraceListener StartupListener, HashSet`1 ScriptModuleAssemblies) in /home/ubuntu/UnrealEngine/Engine/Source/Programs/AutomationTool/AutomationUtils/Automation.cs:line 153

After some research exit code 137 tells me that its an out of memory error. I have the packaging process running on an AWS EC2 instance with 16gb of RAM. I tried applying the process to a CGroup where I limited the RAM to some arbituary number (12GB) to ensure I wouldn’t go over the maximum.

This works, as I monitor the RAM usage using watch -n 1 free -m it shows me that I have excess RAM. However, this line inside the log tells me it is still trying to access 16GB of RAM.

LogInit:  - Physical RAM available (not considering process quota): 16 GB (15732 MB, 16110168 KB, 16496812032 bytes)

This tells me that I need to limit the memory allocation inside unreal itself. I’ve searched the following answers that haven’t seemed to fix anything:

  • Set r.MemoryLimiter [source]
  • MaxMemoryAllowance in BaseEditor.ini (Cannot find reference to this value in any ini config file) [source]

I can’t seem to find any documentation on config files and allocating a set amount of RAM. Does anyone know where I can set these values?

Managed to solve this?