cgm-zig

Build a very large Zig project with a compiler that finishes the job, and says plainly when it runs out of room.

With cgm-zig the same full build completes in under 45 minutes.completed in under 45 minutes, six full builds in a row without running out of memory cgm-zig under 45 minutes six full builds in a row without running out of memory

On a project of about 1,800 modules, stock Zig 0.16.0 died silently after more than two hours, every time. With cgm-zig the same full build completes in under 45 minutes.

Status: a toolchain for 64-bit Linux is released, and a newer build is published as a prerelease, to try out before relying on it. Every number on this site comes from the repository’s own record, linked beside it.

The same build, two compilers

Stock Zig 0.16.0silent crash after more than 2 hours, every time
On a project of about 1,800 modules, stock Zig 0.16.0 died silently after more than two hours, every time.
cgm-zig 0.16.0+cgm.046d6833completed in under 45 minutes, six full builds in a row without running out of memory
With cgm-zig the same full build completes in under 45 minutes.
The bars share one scale: the full width is 2 hours. The workload is about 1,800 named modules, about 2,300 files, analysed as one compilation unit. The times are the maintainer’s build station’s own timestamps from 2026-08-30. They are a wall-clock reading, not a speed claim against any other setup. Sources: the README and the release notes.

Why it exists

Zig’s compiler keeps its work in tables addressed by 32-bit indexes. On a project this large, an empty-slot marker was read as a real index and the compiler died with no message at all. Stock release builds leave out the check that would have named the problem.

cgm-zig keeps that check, so running out of room now stops with a message that names the thread, the index reached and the limit. It also raises the limit it was hitting, from 67,108,863 to 134,217,727 items per partition. The details, with the files and commits, are on What changes.

Zig’s compiler keeps its work in tables addressed by 32-bit indexes. 32-bit indexes tables empty-slot marker
It also raises the limit it was hitting, from 67,108,863 to 134,217,727 items per partition. items per partition 67,108,863 134,217,727

It changes nothing in the language. Every new behaviour sits behind a new flag, and a stock invocation behaves like stock Zig.

The runs the repository records, each with its workload. They are wall-clock readings on the maintainer’s build station; the rows are different workloads and are not compared with each other.
Recorded runs
CompilerWorkloadWhat the record showsSource
Stock Zig 0.16.0The full build of about 1,800 modules, as one compilation unitDied silently after more than two hours, every timeREADME
cgm-zig 0.16.0+cgm.046d6833The same full buildCompleted in under 45 minutes, six full builds in a row without running out of memoryREADME
cgm-zig at commit a7f31c36The same workload, the run in which the named message fired twiceCompleted, exit 0, in 18 min 10 s with an 18.4 GiB peakREADME, (a)
Building cgm-zig itselfA clean build of the compiler under an 8-CPU mask on a busy hostAbout 41 minutes; 8 to 9 minutes on an idle, unconstrained hostBUILDING.md

Where to go next