zed-industries/zed · error
failed to allocate
Error message
failed to allocate
What it means
Generic allocation failure raised in `DirectXAtlas::get_or_insert_with` (via insert_tile) when `lock.allocate(...)` returns None: the Direct3D atlas texture has no free tile of the requested size (atlas full, or the requested tile exceeds the atlas dimensions). The message is a sentinel from the allocator, not a Win32 error.
Solutions
- Grow the atlas texture or add a second atlas page when allocation fails.
- Evict unused tiles (LRU) before failing.
- Reject oversized tiles early with a clearer 'tile too large for atlas' error.
- Log tile size and current atlas occupancy to diagnose fragmentation.
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at crates/gpui_windows/src/directx_atlas.rs:90 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@916fc2b8cb (2026-09-19).
Data as JSON: /api/errors/3b199b1c65f588af.
Report an issue: GitHub.
Appendix: source
Thrown at crates/gpui_windows/src/directx_atlas.rs:96
) -> anyhow::Result<Option<AtlasTile>> {
self.0.lock().get_or_insert_with(key, build)
}
fn remove(&self, key: &AtlasKey) {
self.0.lock().remove(key);
}
}
impl AtlasBackend for DirectXAtlasTextures {
fn insert(
&mut self,
kind: AtlasTextureKind,
size: Size<DevicePixels>,
bytes: &[u8],
) -> anyhow::Result<AtlasTile> {
let tile = self
.allocate(size, kind)
.ok_or_else(|| anyhow::anyhow!("failed to allocate"))?;
let texture = self.texture(tile.texture_id);
texture.upload(&self.device_context, tile.bounds, bytes);
Ok(tile)
}
fn remove(&mut self, tile: AtlasTile) {
let id = tile.texture_id;
let textures = match id.kind {
AtlasTextureKind::Monochrome => &mut self.monochrome_textures,
AtlasTextureKind::Polychrome => &mut self.polychrome_textures,
AtlasTextureKind::Subpixel => &mut self.subpixel_textures,
};
let Some(texture_slot) = textures.textures.get_mut(id.index as usize) else {
return;
};
View on GitHub (pinned to 916fc2b8cb)