Unreal GPU Memory Footprint

Hello!

I’d have a question about UE GPU memory usage. Due to the fact that I’m trying to target as low hardware as possible I’ve turned off Texture memory streaming and trying to fit all the textures in the level at a 1GB video memory usage.

When using ‘stat memory’ I see that the ‘Texture memory 2D’ is at 379MB.

When I use ‘stat rhi’ I see that there are many things that use the gpu memory.

1.Render target memory 2D - 466MB

2.Texture memory 2D - 379MB

3.Texture memory Cube 95MB

4.Structured buffer memory 59MB

5.Vertex buffer memory 50MB

Others are neglect-able. I’ve attached a image showing the stats:

So my questions are:
1.Is my memory usage 1098 GPU memory, that is the sum of all those stats?

2.Is the ‘Texture Memory 2D’ the usage of the textures that I’ve imported?

3.Why is that ‘Render target memory 2D’ so high?

4.Why is the ‘Texture memory cube’ so high since I only use 1 reflection probe

5.Why are there 557 ‘DrawPrimitive’ calls? I’ve taken the stat in a place of the scene where nothing is draw (an empty spot without any meshes or lights casting in it)

Is there any way to deep profile the GPU memory usage and maybe see where all that extra data comes from?

Thanks & Regards!

4 Likes

For those finding themselves in the same situation as me the following steps should be done when doing memory profiling:

  1. Close the editor and open it again so that all dangling memory is released
  2. Launch the game as a stand-alone instead of ‘Play In Current Viewport’
  3. Use ‘memreport -full’ for a full detailed dump on the memory usage

The interpreting of the values goes as follows:

  • “RHI resource memory (not tracked by our allocator)” - Section is related to GPU memory usage, a value after all the data is shown. In my case it was ‘683MB total’. Since we’re targeting GTX550+ I guess that we have around 300MB more of video memory that we can use.
  • “Pooled Render Targets” - Section related to the “Render Target Memory 2D”. It explains there the high render target memory usage. It is high due to all the buffers allocated, especially the DBuffer textures. It also seems not to show real values all the time, that is why an editor restart is required.
  • “Listing all textures” - Section related to the textures used by your game. The list is ordered from highest memory to lowest. The top textures are a good start on optimizing. Remember that a 2k texture means about 4 1024 textures or 16 512 textures! Better use tiling textures, detail textures etc.

The video memory consumption you are targeting for is determined by the GPU that you are targeting (we’re targeting GTX 550 with 1GB Vram) and if you are using texture streaming or not.

CPU memory profiling is a lot easier I’ll not get in details with that too.

Even though many Unreal users already know what I’ve listed, maybe there would be some newcomers with the engine (like myself) that require a little bit of help when profiling the GPU usage. Searching info over the internet linked me back to my question so maybe anyone will find it useful.

9 Likes

Huge thanks for sharing!

I’ve tried typing memreport -full into the console in a standalone game, but it appears to do nothing. Does it output a file for analysis, or is there another step that’s missing?

Found the answer in this post. Paraphrasing here for posterity: you can find the output in your project’s Saved\Profiling\MemReports\ directory. It’s a simple text file that you should be able to read.

1 Like

@AssemblerJohn What do you mean by CPU memory profiling? is it RAM usage you are talking about. Also can you please share pointers around how to profile?

You’ve probably found the solution to this already; but for anyone else that runs into this;
running “memreport -full” or “memreport” will run a string of commands that dumps the results in two places…

  1. Your output log in the editor, which may be difficult to read due to the sheer amount of data it produces.
  2. You project’s saved folder; project_name/Saved/Profiling/MemReports/blahblah.memreport - open the file in an editor like Notepad++ or Sublime text)

You can use a compare plugin in Notepad++ to monitor changes in memory, which can be useful for hunting down leaks.

2 Likes