Description

It is possible for a class that implements IPreLoadScreen to leak memory if GetPreLoadScreenType returns EngineLoadingScreen and IsDone returns true before the engine signals loading is completed via SetEngineLoadingFinished.

While it does appear the EngineLoadingScreen's must respect the loading state, a memory leak is not an ideal behaviour when violating that requirement. An error when this behaviour triggers or an explicit mention of this pitfall in the comment for IsDone may be preferable.

The root cause appears to be that DrawWindow always builds rendering buffers, but the flush of said buffers only occurs when IsDone returns false.

Steps to Reproduce

The reproduction steps here are relatively abrupt. Reproducing this issue may require a decently sized project to induce a sufficient loading time to leak enough memory to crash the application.
1. Create a project that uses a PreLoadingScreen that inherits from PreLoadScreenBase (This will default to EngineLoadingScreen.)
2. Have the PreLoadingScreen always return true, regardless of the current loading state.
3. Elongate the loading time. This is unfortunately left as an exercise for the reader. Using a heavy project is one of the more reliable ways to induce this.

Expected: To not leak memory
Actual: Leak caused by allocating memory when building rendering buffers but never flushing

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-237367 in the post.

0
Login to Vote

Unresolved
ComponentUE - Graphics Features
Affects Versions5.45.5
CreatedJan 9, 2025
UpdatedJan 9, 2025
View Jira Issue