Show HN: Zero C#, Power of C# without any GC onurgumus.github.io · 45 points · 3...
Show HN @show
Show HN: Zero C#, Power of C# without any GC onurgumus.github.io · 45 points · 33 comments · HN thread
TL;DR Zero C# is a fork of the bflat compiler that turns C# source into small standalone native programs with no .NET runtime and no garbage collector. Memory is managed with arenas that are freed all at once, and a small library replaces parts of the BCL, with the same test suite run on Linux, macOS, Windows, WebAssembly and DOS.
- Compiles C# straight to native code; hello world is about 11 KB on Windows and 40 KB on Linux, with nothing to install.
- No garbage collector: memory comes from arenas freed all at once, and temporary text is formatted into buffers or stack spans.
- Keeps C# syntax, type checking, generics (specialized per type), interfaces, records, lambdas and a LINQ-like library, plus Parallel.For.
- Drops exceptions (errors are returned as unions), reflection and async; throw ends the program.
- Targets Linux x64/arm64, macOS on Apple Silicon, Windows x64, WebAssembly (WASI) and DOS on a 386 via the HX extender, tested under Wine, wasmtime and Bochs.
Discussion The thread is skeptical and somewhat argumentative. Many commenters ask what this adds over NativeAOT and existing low-allocation C# tools like Span, stackalloc and Marshal, and a large share defend the GC as a feature that is controllable rather than a loss of control. Others see a niche for a low-level, C-like language with C#'s syntax, and a few joke about names or LLM-era coding. The mood is mixed: curious and sometimes dismissive, with a few people praising the DOS demo as a proof of concept.
- Existing C# tools already cover performance-critical needs (many): Commenters point to unsafe code, pointers, Span, stackalloc, Marshal, and NativeAOT as sufficient, and ask what this fork adds beyond them. NativeAOT is noted as not removing the GC but the JIT, and as not being able to target DOS.
- The GC is a feature; control allocation instead (many): Several argue that GC pressure, not the GC itself, is the real problem, and that careful allocation and GC settings such as latency modes solve most issues. One commenter reports a 24/7 production system with zero over-allocation over 90 days.
- A real niche for C#-like low-level code (some): Some see value in a native, runtime-free language that keeps C# syntax and avoids C++ complexity and Rust's learning curve, comparing it to Beef and to inline-assembly-style extensions.
- Removing GC makes it a different language (some): Commenters say that without GC and reflection, C# loses what makes it C#, leaving mostly nice syntax on top of manual memory management that most C# developers are not prepared for.
- Arena-only memory is too limiting; reference counting would fit better (a few): Arenas that free only at specific points, such as after a request, do not suit every program. One commenter suggests reference counting, as in Swift, as a better fit for C#.
#csharp #garbageCollection #nativeAOT #compilers #lowLevelProgramming #showHN