Render graph event causes FNamePool to grow on each frame

The issue was introduced in CL 35053471 (Commit dfe3a95) and occurs when the HAS_GPU_STATS macro is enabled (typically in all non-shipping builds).

File: Engine/Source/Runtime/Renderer/Private/DeferredShadingRenderer.cpp

Function: void FDeferredShadingSceneRenderer::Render(FRDGBuilder& GraphBuilder)

FString FrameNumDescription = FString::Printf(TEXT("%s Frame: %d"), *ViewFamily.ProfileDescription, GFrameCounterRenderThread); RDG_GPU_STAT_SCOPE_VERBOSE(GraphBuilder, Unaccounted, *FrameNumDescription);

Since FrameNumDescription contains a frame number, invoking RDG_GPU_STAT_SCOPE_VERBOSE with it creates a unique FName instance each frame, which continuously increases the FNamePool size.

Additionally, Unreal Insights does not support event names containing numbers (see CL 31461244, Commit 4fbe100), so adding an underscore to the event name before the frame number does not resolve the issue.

Steps to Reproduce

  1. Run a basic sample project such as First Person.
  2. Execute the console command "viewnames num=100" several times.
  3. Observe that new FName entries appear in the log each time the command is executed (e.g., “Unaccounted - Frame: 6972”).

Thanks for reporting it Oleg!

I submitted a fix in CL 44598054 removing the dynamic frame number from the scope since the new GPU Profiler has the frame number scope as the top one in the breadcrumb stacks.