Memory leak while reading UTextureRenderTarget2D pixel data

e3delyptos
Mon, 11 Nov 2024 15:07:30 +0000
C++

Hello everyone.

In our project we are experiencing a severe memory leak. It seems to happen while reading the pixel data of a render target. We are doing this every frame after capturing the scene with a USceneCaptureComponent2D.

I was able to reproduce this in a clean project. Attached to this post you can find a simple C++ actor which reads a render target every tick. You can drop this actor in an empty map and observe the memory consumption using Unreal Insights after either starting a packaged game or starting PIE.

My question is, is anyone else experiencing this issue? Is this maybe because we need to manually free some allocation after calling ReadSurfaceData? Or is this an engine bug?

Engine version: 5.3

RHI: DirectX 12

OS: Windows 10

MemoryLeak.cpp (1.7 KB)
MemoryLeak.h (592 Bytes)

1 post - 1 participant