{"record":{"id":"77a54a984b1ae922","repo":"iced-rs/iced","slug":"error","errorCode":null,"errorMessage":"{error:?}","messagePattern":"\\{error:\\?\\}","errorType":"panic","errorClass":"compositor::SurfaceError::OutOfMemory","httpStatus":null,"severity":"critical","filePath":"winit/src/lib.rs","lineNumber":947,"sourceCode":"                        });\n\n                        window.draw_preedit();\n\n                        let present_span = debug::present(id);\n                        match current_compositor.present(\n                            &mut window.renderer,\n                            &mut window.surface,\n                            window.state.viewport(),\n                            window.state.background_color(),\n                            || window.raw.pre_present_notify(),\n                        ) {\n                            Ok(()) => {\n                                present_span.finish();\n                            }\n                            Err(error) => match error {\n                                compositor::SurfaceError::OutOfMemory => {\n                                    // This is an unrecoverable error.\n                                    panic!(\"{error:?}\");\n                                }\n                                compositor::SurfaceError::Outdated\n                                | compositor::SurfaceError::Lost => {\n                                    present_span.finish();\n\n                                    // Reconfigure surface and try redrawing\n                                    let physical_size = window.state.physical_size();\n\n                                    if error == compositor::SurfaceError::Lost {\n                                        window.surface = current_compositor.create_surface(\n                                            window.raw.clone(),\n                                            physical_size.width,\n                                            physical_size.height,\n                                        );\n                                    } else {\n                                        current_compositor.configure_surface(\n                                            &mut window.surface,\n                                            physical_size.width,","sourceCodeStart":929,"sourceCodeEnd":965,"githubUrl":"https://github.com/iced-rs/iced/blob/d146509d893945de5c304cfaf4301335eee278bd/winit/src/lib.rs#L929-L965","documentation":"During the winit event loop, presenting the compositor surface failed with `compositor::SurfaceError::OutOfMemory`, which the library treats as unrecoverable and aborts with `panic!(\"{error:?}\")`. All other surface errors (Outdated, Lost, etc.) are handled by reconfiguring and redrawing, but OOM cannot be recovered safely.","triggerScenarios":"`Surface::present` (via the compositor present path) returns `SurfaceError::OutOfMemory`, typically when the GPU/driver cannot allocate the swapchain buffer or memory pressure exhausts the graphics allocator.","commonSituations":"GPU memory exhaustion from large window sizes/high-DPI multi-monitor setups; buggy or outdated graphics drivers; running out of VRAM with many wgpu surfaces; virtualized GPUs with constrained memory (VMs, remote desktop).","solutions":["Update GPU drivers (and wgpu backends/Vulkan ICDs) to current versions.","Reduce memory pressure: lower window resolution/scale factor, close other GPU-heavy applications, shrink buffers.","Handle the error upstream by catching the panic or running the app in a supervised process and retrying after freeing resources.","If reproducible on a specific driver/hardware, file a bug with wgpu/iced including `WGPU_BACKEND` details; try a different backend (`WGPU_BACKEND=gl` or `dx12`)."],"exampleFix":"// environment workaround\n// before: default backend selection\n// after\nWGPU_BACKEND=gl cargo run --release","handlingStrategy":"retry","validationCode":"// Before heavy rendering, handle surface errors in the present path:\nmatch compositor.present(...) {\n    Err(compositor::SurfaceError::OutOfMemory) => { /* free resources, recreate */ }\n    _ => {}\n}","typeGuard":"fn is_oom(err: &iced::compositor::SurfaceError) -> bool {\n    matches!(err, iced::compositor::SurfaceError::OutOfMemory)\n}","tryCatchPattern":"// The library panics; supervise the process externally or catch at the boundary\nlet outcome = std::panic::catch_unwind(AssertUnwindSafe(|| app.run(settings)));\nif outcome.is_err() { /* log OOM, free GPU resources, relaunch */ }","preventionTips":["Keep GPU drivers and wgpu updated.","Avoid very large windows/multi-surface setups on low-VRAM devices.","Monitor VRAM in profiling during development.","Test on the lowest-spec target hardware you support."],"tags":["rust","gpu","wgpu","out-of-memory","surface","panic"],"backgroundTag":"api-error-response","analyzedSha":"d146509d893945de5c304cfaf4301335eee278bd","analyzedAt":"2026-09-11T16:54:14.229Z","contentChangedAt":"2026-09-11T16:54:14.229Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}