Nim 2.4 Ships With a Thread-Safe Cycle Collector, Parallel Incremental Builds and Concise Sum Types
Nim 2.4.0 arrived as a stable release with a thread-safe cycle collector, parallel incremental builds and concise sum types, followed two weeks later by a 65-commit patch release.
Overview
The Nim programming language’s core team shipped Nim 2.4.0 as a new stable release on October 28, 2026, describing it as “a major update shipping major new features” after what the team called “a way-too-long period of development.” Two weeks later, on November 13, 2026, the team followed with Nim 2.4.2, the first patch release for the 2.4 branch, containing 65 commits of bugfixes and improvements.
What We Know
According to the 2.4.0 announcement, the release bundles five headline features: a --strings:sso flag for small-string-optimized string processing, an --ic:on flag enabling parallel incremental rebuilds, a new thread-safe cycle-collecting memory manager called YRC (activated with --mm:yrc), more concise syntax for sum types, and support for cyclic module dependencies declared with the {.cyclic.} pragma.
The SSO string work introduces a new low-level API — readRawData, readRawDataStable, and the beginStore/endStore pair — meant to replace the pattern of taking a raw pointer via addr myString[offset], which the announcement says is being deprecated “to replace it with operations that clarify the intent.”
Incremental compilation (IC) relies on multi-processing rather than multi-threading for parallel builds, and the team published a concrete benchmark: “compiling the Nim compiler itself takes 31s with —ic:off on a machine with 16 physical cores, and 25s with —ic:on,” according to the 2.4.0 post.
YRC — described in the announcement as the “thread-safe variant of Nim’s ORC” — is meant to close a gap in Nim’s existing memory-management options: ORC’s cycle collector only handles reference cycles that stay inside a single thread, while YRC can collect cycles that span multiple threads. The team was explicit about the cost of that capability, writing, “In our orcbench, YRC is about 2.0× slower than ORC and it uses twice as much memory, too.”
The sum-types feature gives Nim’s existing discriminated-union objects a more compact declaration syntax, dropping the separate enum-and-case-object boilerplate. The team notes, “Under the hood a sum type is still a case object with a hidden discriminator, so the memory layout and the performance are the same as before,” and that fields “can only be accessed via pattern matching,” which the announcement says prevents the “classic FieldDefect” that previously resulted from reading the wrong case-object branch. Existing case objects “continue to work and are not deprecated,” per the same post.
The release also ships an experimental owned ref T modifier, gated behind an --experimental:ownedRefs flag; the team’s own warning in the post reads, “I can promise you that we will break your code again if you use the feature.” Separately, on the same day as 2.4.0, the team also released Nim 2.2.14, a patch release for users who want to remain on the 2.2 branch rather than upgrade to 2.4, which the announcement describes as containing “many bugfixes and security fixes.”
The follow-up 2.4.2 patch, released November 13, fixed a range of regressions and bugs, among them a Windows console memory-corruption issue triggered by Ctrl+C during readLine, a crash in std/unicode’s lastRune and runeStrAtPos functions on invalid UTF-8 input, a JSON round-trip comparison bug introduced by the new --strings:sso mode, an asm statement code-generation issue where blocks were emitted without volatile and could be merged or hoisted by the C compiler, and a segfault regression affecting ARC/ORC destructors in -d:release builds. The 65-commit range between the two versions is recorded in the project’s GitHub compare view.
What We Don’t Know
Neither announcement discloses adoption figures, download counts, or community feedback on the 2.4 release. The team’s benchmark figures for IC and YRC — the 31-second-versus-25-second compiler build and the “orcbench” cycle-collector comparison — come from the team’s own internal testing rather than an independently reproduced measurement.