{"record":{"id":"2a11247668260317","repo":"iced-rs/iced","slug":"create-clip-mask","errorCode":null,"errorMessage":"Create clip mask","messagePattern":"Create clip mask","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"info","filePath":"tiny_skia/src/window/compositor.rs","lineNumber":66,"sourceCode":"        Ok(new(display))\n    }\n\n    fn create_renderer(&self, settings: renderer::Settings) -> Self::Renderer {\n        Renderer::new(settings)\n    }\n\n    fn create_surface(\n        &mut self,\n        window: impl compositor::Window + Clone,\n        width: u32,\n        height: u32,\n    ) -> Self::Surface {\n        let window = softbuffer::Surface::new(&self.context, Box::new(window.clone()) as _)\n            .expect(\"Create softbuffer surface for window\");\n\n        let mut surface = Surface {\n            window,\n            clip_mask: tiny_skia::Mask::new(1, 1).expect(\"Create clip mask\"),\n            frames: VecDeque::new(),\n            max_age: 0,\n        };\n\n        if width > 0 && height > 0 {\n            self.configure_surface(&mut surface, width, height);\n        }\n\n        surface\n    }\n\n    fn configure_surface(&mut self, surface: &mut Self::Surface, width: u32, height: u32) {\n        surface\n            .window\n            .resize(\n                NonZeroU32::new(width).expect(\"Non-zero width\"),\n                NonZeroU32::new(height).expect(\"Non-zero height\"),\n            )","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/iced-rs/iced/blob/3de451447bd28217bb535632867550908e29d5d0/tiny_skia/src/window/compositor.rs#L48-L84","documentation":"When a tiny-skia Surface is constructed, iced allocates a placeholder 1x1 clip mask via tiny_skia::Mask::new(1, 1). Mask::new returns None only for zero dimensions or when the width*height allocation exceeds tiny-skia's internal ceiling; with the constant arguments 1x1 neither condition can hold, so this expect is a defensive assertion that effectively cannot fire unless the process is already out of memory.","triggerScenarios":"Only a failed allocation of a single mask byte: the process is at allocator exhaustion at the exact moment a window surface is created. No input or configuration reaches this code path with invalid values because the arguments are the literals 1 and 1.","commonSituations":"Never seen in isolation; if it appears, it accompanies a broader out-of-memory condition such as unbounded layer caching in long-running applications or memory leaks in the embedding application.","solutions":["Treat the panic as an OOM symptom: capture a memory profile of the process at crash time","Reduce the number of simultaneous window surfaces or the retained frame history (max_age frames per surface)","Fix the memory leak in the host application that exhausted the allocator"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Monitor process memory; this expect is effectively an out-of-memory detector for a 1-byte allocation","Bound the number of live window surfaces and their retained frame history in long-running apps"],"tags":["tiny-skia","clip-mask","allocation","rust"],"backgroundTag":"memory-allocation-failed","analyzedSha":"3de451447bd28217bb535632867550908e29d5d0","analyzedAt":"2026-08-17T10:40:26.997Z","contentChangedAt":"2026-08-17T10:40:26.997Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}