Hello,
I’m currently investigating the high Commit Size allocated by our game (around 30 GB), which often causes OOM crashes, even on systems with 32GB of RAM but smaller paging file. I realized that Memory Insights misses around 6 GB of the Heap Allocs, while filtering out all Video Memory allocations.
So I followed the recent article about ETW and Windows Performance Analyzer https://dev.epicgames.com/community/learning/tutorials/b6d3/unreal-engine-fortnite-find-every-byte-part-1-demystifying-untracked-memory
In the WPA trace, I can see all 30+ GB commit sizes in the VirtualAlloc Commit Life Times view. I cross-checked the allocations and found that (almost) all of those I couldn’t see in Memory Insights are coming from FD3D12MemoryPool::Init(). It appears that a portion of the memory, which is intended to be VRAM-only, actually contributes to the large Commit Size without noticeably affecting the Working Set. Running the game with null RHI keeps the Commit Size and Working Set memory much closer to each other, as the Commit Size is significantly lower.
I attached callstack screenshots (attachments #1, 2, 3, 4) of some offending allocations. Not all of them, but enough to confirm that this affects not only texture streaming but also RHI Buffers, including both the engine ones and those from custom SceneProxies.
Off-topic: Since it doesn’t use the VirtualAlloc() WinAPI function, which has a hook set up in UE, so it has no chance to be tracked as a RAM allocation by Memory Insights, where I can only see a similar Heap Allocation to the Video Memory (screenshot #5)
After searching and studying the topic online, I found that this is not an expected behavior, and Commit Size is never intended to be backed by VRAM.
It’s also clear that this is not VRAM spilling into system memory, since the machine I tested on has 24GB of VRAM, and the game barely consumed 10GB during the run.
I checked the flags to ensure that the code path in FD3D12MemoryPool::Init() for PlacedResource doesn’t have unexpected UPLOAD or READBACK memory (screenshot #6), and that added condition was never triggered.
These are all of the potential culprits I can think of at the moment.
Please let me know if it’s possible to free up the committed memory, or if you have any suggestions on what else to check, or if you need any additional information.
Thank you,
Denis