Summary
In a packaged Mac Shipping build (WindowedFullscreen), once the window ends up at 1920x1050 below the menu bar instead of 1920x1080 fullscreen, IOSurfaces leak at about 6-8 per second (~7.5 MB each, ~3 GB/min). The leak continues after the window returns to 1920x1080, until the app is restarted.
What Type of Bug are you experiencing?
Rendering (Graphics / Niagara)
Steps to Reproduce
- Package a Mac Shipping build with FullscreenMode = WindowedFullscreen.
- Launch it and leave it idle.
footprint <pid> | grep IOSurfacestays flat. - Press Alt+Enter twice (windowed, then back to fullscreen) and move the mouse around.
- The window becomes 1920x1050 at y=30, and the IOSurface count climbs steadily.
Expected Result
The IOSurface count stays flat.
Observed Result
The IOSurface count grows without limit; we saw 38 GB of IOSurfaces after 20 minutes. A stack sample shows the render thread blocked in FMetalViewport::GetDrawableInternal → -[CAMetalLayer nextDrawable] → IOSurfaceCreate.
Suspected cause (MetalViewport.cpp):
- GetDrawableInternal (~line 727) releases the drawable and calls nextDrawable again on every call when the drawable size != the back-buffer size, so several unpresented drawables are fetched each frame.
- PresentDrawLayers, single-view branch (~lines 1031-1032): LocalDrawable->retain() is never released on Mac, because it’s only used in the non-Mac presentDrawable path.
Affects Versions
5.8
Platform(s)
Mac
Additional Notes
macOS 27.0, Apple Silicon (M-series), UE 5.8 launcher build, Metal SM6. Shipping builds use WITH_MULTI_VIEW_SLATE_WINDOW_SUPPORT=0, so the single-view PresentDrawLayers branch runs.