mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-07-31 12:49:03 +00:00
Buffer.sync and Buffer.syncFromArrayLists computed the new buffer size in bytes (req_bytes * 2) and then multiplied by @sizeOf(T) again when passing it to newBufferWithLength:, allocating data.len * sizeOf(T)^2 * 2 bytes. For the 32-byte CellText buffers this is a 64x over-allocation and for the 4-byte CellBg buffers 8x, per swap-chain frame (e.g. ~9.4MB instead of ~300KB per frame for a full 120x40 screen of text). Match the OpenGL buffer implementation: track the new length in units of T and multiply by @sizeOf(T) exactly once.