Project fails to package | Out of memory in Stage command

Hello,

When I try to package my game for Windows 64 bit I receive the following error as shown in the screenshot below:

I have tried:

  1. Increasing my paging file size to 3x my RAM for the maximum and 1.5x for my initial (I have 16GB RAM)
  2. Setting it to automatically manage paging file size for all drives instead
  3. Deleting my Intermediate and Saved folders in the project
  4. Enabling create compressed cooked packages, exclude editor content, share material shader code, Shared Material Native libraries and specify list of maps to include
  5. Fixing redirectors and reimporting recently added textures based on this post: Packaging Error - 64 Bits - Memory Error? - Platform & Builds - Unreal Engine Forums

I tried packaging a third person template game on the same engine version and it works.

Although 16gb should be plenty for most small projects, it could be that you’re genuinely running out of memory.
You could try cooking the project first (File → Cook content for …) and then package (like you would normally do).

Otherwise, you could try optimising the project:

  • Remove unused asset
  • Resize large textures
  • Resize textures to a power of 2.
  • Compress any sound assets you have
  • Resize baked light maps
  • Clean/Retopo any high poly 3d assets

You can also right click your Content folder (in the content browser) and click “Size Map” to check which assets are taking up all the space.

Hi Gamji,

So I solved it by disabling create compressed cooked packages in the packaging settings which is what “Kleber” (post #11 latest post at time of writing, pretty recently too just a few days ago) said he has done in this forum post: "Ran out of memory allocating x bytes with alignment 0" Error when saving-loading - C++ Programming - Unreal Engine Forums.

I may search why creating compressed cooked packages causes these errors in the stage command, may it have to do what you suggested? Obviously it is desirable to have compressed cooked packages enabled. The packaged project currently stands at 4.35GB which I think is rather large for the kind of game I made. From your points maybe baked light maps might be causing it? I have 2 meshes which I’ve set their lightmap resolution to be 4K cuz they’re massive. But I thought after you bake it it just gets stored in a file and that’s it. Also I used your tip of Size Map and the size of the built data for the level is quite large alongside with blueprints. But I’m not sure that would cause packaging to fail with create compressed packages on.

As for the other points, I’ve removed the majority of unused assets and would like to keep my textures at 4K/2K. I don’t have really high poly 3d assets I don’t think. The textures I use for my meshes are in powers of 2 and I understand they need to be for mipmaps, only the textures which are UI related stuff aren’t, unless these should be too or at least be even numbers to get it to work with compressed cooked packages on?

Also I tried just cooking the project first, as you suggested, even with the create compressed cooked packages option on. It worked just fine. Its just in the packaging stage (stage command) where I get the error.

So this person found that if you use GPU lightmass to bake the lightmaps, you can package the game with create compressed cooked packages on. https://answers.unrealengine.com/questions/999835/426-25-create-compressed-cook-packages-memory-cras.html

I’m also getting this with UE 4.27 (I wasn’t even able to build with UE 5)

I have 4G MSI GeForce 1650, an AMD Ryzen 9 3900X 12 Core with 32G of RAM and a 2Tb SSD

I’ve tried many things I found here and am waiting on order for new video card (12G) and more RAM (up to 64G) but I’m thinking this might be a bug.

Here’s a log snippet:

UATHelper: Packaging (Windows (64-bit)): LogCook: Display: Cooked packages 7692 Packages Remain 419 Total 8111
UATHelper: Packaging (Windows (64-bit)): LogTexture: Display: Building textures: Billboard_8K_Opacity (OODLE_BC7, 8192X8192)
UATHelper: Packaging (Windows (64-bit)): LogTextureFormatOodle: Display: non-RDO encode 8192 x 8192 x 1 to format OODLE_BC7 (Oodle OodleTex_BC7RGBA) lambda=0 effort=20
UATHelper: Packaging (Windows (64-bit)): LogShaderCompilers: Display: === FShaderJobCache stats ===
UATHelper: Packaging (Windows (64-bit)): LogShaderCompilers: Display: Total job queries 17961, among them cache hits 1214 (6.76%)
UATHelper: Packaging (Windows (64-bit)): LogShaderCompilers: Display: Tracking 9597 distinct input hashes that result in 4467 distinct outputs (46.55%)
UATHelper: Packaging (Windows (64-bit)): LogShaderCompilers: Display: RAM used: 46.36 MB (0.05 GB) of 1638.40 MB (1.60 GB) budget. Usage: 2.83%
UATHelper: Packaging (Windows (64-bit)): LogShaderCompilers: Display: ================================================
UATHelper: Packaging (Windows (64-bit)): LogThreadingWindows: Error: Runnable thread PoolThread 38 crashed.
UATHelper: Packaging (Windows (64-bit)): LogWindows: Error: begin: stack for UAT
UATHelper: Packaging (Windows (64-bit)): LogWindows: Error: === Critical error: ===
UATHelper: Packaging (Windows (64-bit)): LogWindows: Error:
UATHelper: Packaging (Windows (64-bit)): LogWindows: Error: Fatal error: [File:D:/Build/++UE4/Sync/Engine/Source/Runtime/Core/Private/GenericPlatform/GenericPlatformMemory.cpp] [Line: 197]
UATHelper: Packaging (Windows (64-bit)): LogWindows: Error: Ran out of memory allocating 268435456 bytes with alignment 0

Hi DragonSlayer981

Today got same problem. My project is much bigger but still. To buy more memory for me now is a problem so i tried to increase my memory in other way. Easies way is to use ur Hard drive or SSD as RAM when you dont have enough memory. I did it and it wocked. The only think that you have to keep in mind, is that you better dont use this method all the time. You can easily google how use ur hard as ram, but make it only on packaging, after it disable those setting on ur PC because this method by a bit is killing your Hard and SSD. I mean you can make it and 1000 times, but dont let those settings on, all the time if you want to use for a long time especially if you have ssd. Hope it was helfull for you))) GL