Cooker out of memory

I’m getting out of memory crashes when trying to cook/package our game. The command line I’m using for this is:

../Engine/Engine/Build/BatchFiles/RunUAT.sh BuildCookRun -nop4 -compile -project=/path/to/project/game/Game.uproject -cook -allmaps -stage -archive -archivedirectory=../Packages -package -LinuxNoEditor -clientconfig=Development -ue4exe=UE4Editor -pak -targetplatform=Linux -build -utf8output [-incremental]

I can observer the process utilizing more and more memory (the system has a total of 16 GB) and swap space until it crashes with this message:

Cook: LogLinux:Error: appError called: Assertion failed: Assertion failed:  [File:/path/to/project/Engine/Engine/Source/Runtime/Core/Private/GenericPlatform/GenericPlatformMemory.cpp] [Line: 319]
Cook: munmap(addr=0x7f3237664000, len=49152) failed with errno = 12 (Cannot allocate memory)
Cook: Fatal error: [File:/path/to/project/Engine/Engine/Source/Runtime/Core/Private/GenericPlatform/GenericPlatformMemory.cpp] [Line: 319]

There seems to be a notable amount of memory freed after the compilation but the freed memory during the cooking is nearly neglectable. I suspect especially the ogg audio compression to be a major factor for the memory consumption.
I already made a clean rebuild of the entire project including all Saved and Intermediate folders but it didn’t change anything regarding this issue.

Thanks in advance for any hints or recommendations.

Try merging this fix (slated to be in 4.16.3): https://github.com/EpicGames/UnrealEngine/commit/9f26ea17f7a01a6289bf29fa04d927933e6d29fa

I just merged it and ran the first tests and can confirm that it is working so far. The process still consumes nearly 20 GB of ram and swap in total but does not crash anymore.
Thanks a lot for your help and your quick response.

I’m experiencing this issue but the github link provided in the answer no longer works.

Is there an update on this answer?