Keywords: UE4, Ran out of memory allocating 1073741824 bytes with alignment 0

Issues

Out of Video Memory Trying to Allocate a Texture

UE4Editor crashed on start: Out of Video Memory Trying to Allocate a Texture:

Callstack of crash:

Assertion failed: [File:D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Private\GenericPlatform\GenericPlatformMemory.cpp] [Line: 212] Ran out of memory allocating 1073741824 bytes with alignment 0

UE4Editor_Core!FWindowsErrorOutputDevice::Serialize() [d:\build\++ue4\sync\engine\source\runtime\core\private\windows\windowserroroutputdevice.cpp:79]
UE4Editor_Core!FOutputDevice::LogfImpl() [d:\build\++ue4\sync\engine\source\runtime\core\private\misc\outputdevice.cpp:71]
UE4Editor_Core!AssertFailedImplV() [d:\build\++ue4\sync\engine\source\runtime\core\private\misc\assertionmacros.cpp:101]
UE4Editor_Core!FDebug::AssertFailed() [d:\build\++ue4\sync\engine\source\runtime\core\private\misc\assertionmacros.cpp:449]
UE4Editor_Core!FGenericPlatformMemory::OnOutOfMemory() [d:\build\++ue4\sync\engine\source\runtime\core\private\genericplatform\genericplatformmemory.cpp:212]
UE4Editor_Core!FMallocTBB::Realloc() [d:\build\++ue4\sync\engine\source\runtime\core\private\hal\malloctbb.cpp:140]
UE4Editor_Core!FMemory::Realloc() [d:\build\++ue4\sync\engine\source\runtime\core\public\hal\fmemory.inl:52]
UE4Editor_ImageCore!TArray<unsigned char,FDefaultAllocator>::ResizeTo() [d:\build\++ue4\sync\engine\source\runtime\core\public\containers\array.h:2475]
UE4Editor_ImageCore!InitImageStorage() [d:\build\++ue4\sync\engine\source\runtime\imagecore\private\imagecore.cpp:22]
UE4Editor_ImageCore!FImage::FImage() [d:\build\++ue4\sync\engine\source\runtime\imagecore\private\imagecore.cpp:248]
UE4Editor_TextureCompressor!GenerateMipChain() [d:\build\++ue4\sync\engine\source\developer\texturecompressor\private\texturecompressormodule.cpp:714]
UE4Editor_TextureCompressor!FTextureCompressorModule::BuildTextureMips() [d:\build\++ue4\sync\engine\source\developer\texturecompressor\private\texturecompressormodule.cpp:2228]
UE4Editor_TextureCompressor!FTextureCompressorModule::BuildTexture() [d:\build\++ue4\sync\engine\source\developer\texturecompressor\private\texturecompressormodule.cpp:1929]
UE4Editor_Engine!FTextureCacheDerivedDataWorker::BuildTexture() [d:\build\++ue4\sync\engine\source\runtime\engine\private\texturederiveddatatask.cpp:148]
UE4Editor_Engine!FTextureCacheDerivedDataWorker::DoWork() [d:\build\++ue4\sync\engine\source\runtime\engine\private\texturederiveddatatask.cpp:315]
UE4Editor_Engine!FAsyncTask<FTextureCacheDerivedDataWorker>::DoWork() [d:\build\++ue4\sync\engine\source\runtime\core\public\async\asyncwork.h:262]
UE4Editor_Engine!FAsyncTask<FTextureCacheDerivedDataWorker>::DoThreadedWork() [d:\build\++ue4\sync\engine\source\runtime\core\public\async\asyncwork.h:286]
UE4Editor_Core!FQueuedThread::Run() [d:\build\++ue4\sync\engine\source\runtime\core\private\hal\threadingbase.cpp:505]
UE4Editor_Core!FRunnableThreadWin::Run() [d:\build\++ue4\sync\engine\source\runtime\core\private\windows\windowsrunnablethread.cpp:96]

Soulution:
This PC -> Properties -> Advanced system settings -> Advanced -> Performance -> Advanced -> Virtual memory -> set Custom size larger then 10GB.

Reference:
How to Fix Fortnite Out of Video Memory Trying to Allocate a Texture Error | Epic Games Launcher.
https://www.youtube.com/watch?v=ktCVs1_hsSM

Attention:
This issue might be caused by insufficient video memory. If you increased Virtual Memory of OS and run large scale UE4 project (with textures in huge size, e.g. more than 200MB per texture) on a graphic card that memory was insufficient, IT MAY CAUSE PHYSICAL HARM TO YOUR HARDWARE(GPU).

e.g. the callstack of crash as shown in following. Get this error may well mean your video card have got physical harm.

Assertion failed: GD3D11RHI->GetQueryData(Query->Resource, &Query->Result, sizeof(Query->Result), Query->QueryType, true, false) [File:D:/Build/++UE4/Sync/Engine/Source/Runtime/Windows/D3D11RHI/Private/D3D11Query.cpp] [Line: 45]

UE4Editor_Core
UE4Editor_Core
UE4Editor_D3D11RHI
UE4Editor_D3D11RHI
UE4Editor_RHI
UE4Editor_Renderer
UE4Editor_Renderer
UE4Editor_Renderer
UE4Editor_Core
UE4Editor_Core
UE4Editor_RenderCore
UE4Editor_RenderCore
UE4Editor_Core
UE4Editor_Core
kernel32
ntdll

If you continue to run large scale UE4 project on this device, you may get an issue on your OS:

display adapter Windows has stopped this device because it has reported problems. (Code 43)
Run out of memory on starting project for the first time (compiling shaders)

Issue:
Start editor for the first time could easily cause program to run out of memory if there’re some large size of textures in your project.
My PC has 32GB RAM, my project just costed 9GB RAM after building completed, but it would run out of 32GB RAM on first building.

Caused by:
It’s a issue of engine: if size of textures that were contained in your project is huge (e.g. more than 200MB), then they would run out of RAM on compiling shaders (startup editor for the first time).

Solution:
Increase Virtual memory of OS as large as possible, e.g. 50GB.

There’s also a issue on compiling shaders with textures in large size if there’s a USB drive was plugged on PC.
You’d better eject all USB drives and portable hard drives before build project for the first time.

Run UE4 editor on MacOS or Linux would be better, because memory management on Linux is better than Windows. :(


To understand everything is to hate nothing. ― Romain Rolland