8000 macos: drain an autorelease pool each time round the run loop by benface · Pull Request #676 · not-fl3/miniquad · GitHub
[go: up one dir, main page]

Skip to content
10000
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/native/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1468,6 +1468,10 @@ where
};
let mut done = false;
while !(done || crate::native_display().lock().unwrap().quit_ordered) {
// `[NSApp run]` drains an autorelease pool each time round. Without
// one, nothing a frame autoreleases is ever freed: its command
// buffers, and with them every texture they drew with.
let pool = objc::runtime::objc_autoreleasePoolPush();

// Wait at the top for just in time rendering
if let Some(frame_pacer) = frame_pacer.as_ref() {
Expand Down Expand Up @@ -1510,5 +1514,6 @@ where
perform_redraw(&mut display, conf.platform.apple_gfx_api, false);
}

objc::runtime::objc_autoreleasePoolPop(pool);
}
}
Loading
0