# \[5.8\]\[Mac\] Metal drawable/IOSurface leak after WindowedFullscreen window is resized below the menu bar 

**URL:** <https://forums.unrealengine.com/t/5-8-mac-metal-drawable-iosurface-leak-after-windowedfullscreen-window-is-resized-below-the-menu-bar/2859186>\
**Category:** Issues and Bug Reporting (Unreal Engine)\
**Tags:** unreal-engine\
**Created:** [November 19, 2026, 6:08pm UTC](https://forums.unrealengine.com/t/5-8-mac-metal-drawable-iosurface-leak-after-windowedfullscreen-window-is-resized-below-the-menu-bar/2859186 "2026-11-19T18:08:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lastchanc3saloon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@lastchanc3saloon](https://forums.unrealengine.com/u/lastchanc3saloon)\
**Post date:** [November 19, 2026, 6:08pm UTC](https://forums.unrealengine.com/t/5-8-mac-metal-drawable-iosurface-leak-after-windowedfullscreen-window-is-resized-below-the-menu-bar/2859186/1 "2026-11-19T18:08:50Z")

</div>

### 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

1. Package a Mac Shipping build with FullscreenMode = WindowedFullscreen.
2. Launch it and leave it idle. `footprint <pid> | grep IOSurface` stays flat.
3. Press Alt+Enter twice (windowed, then back to fullscreen) and move the mouse around.
4. 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.
