Zero C# Compiles C# to Native Code With No Runtime or Garbage Collector
A fork of bflat lets developers write C# that compiles to tiny native binaries, 11 KB on Windows, 40 KB on Linux, running on everything from a 386 to WebAssembly, with memory managed through explicit arenas instead of a GC.

By Ryan Chua, Cloud & Enterprise Tech
3 min read
What changed
Onur Gumus has released Zero C#, a fork of the bflat compiler that compiles C# directly to native machine code with no .NET runtime, no garbage collector, and no dependencies beyond the platform C library. The same source code builds and runs on Linux, macOS, Windows, WebAssembly, and even DOS on a 386.
The project is MIT-licensed (the core library) and built on a fork of bflat which is AGPL-3.0. Source is on GitHub.
What Zero C# can do
Tiny native binaries from C# source
A minimal Hello World compiles to:
Windows x64: 11 KB (
bin/win/Minimal.exe)Linux x64/arm64: 40 KB (
bin/Minimal)macOS [Apple](/tech/mozilla-says-apples-browser-engine-rules-still-block-firefox-on-ios-after-three-years) Silicon: 65 KB (
bin/mac/Minimal)WebAssembly: 16 KB (
bin/wasm/Minimal.wasm)DOS on 386: runs the same WebAssembly build's bitcode under FreeDOS
Each build is tested by the same test suite requiring identical output everywhere.
Memory management through arenas
Instead of a garbage collector, Zero C# uses arenas, memory regions that you free all at once when you decide. The core library (zerocore, ~2,400 lines of C# plus three short assembly routines per architecture) provides:
Str, strings backed by arena memoryList<T>andDict<TKey, TValue>, collections living in arenasIn/Out, console I/O without allocations per operationSpan<T>andstackallocfor stack buffers
// Read into a stack buffer: nothing allocated per answer
Span<char> buffer = stackalloc char[32];
Out.Write($"Q {i}: {a} + {b} = ");
int length = In.ReadLine(buffer);
// Kept until the end, so it goes into an arena
mistakes.Add(Str.Format(keep, $" {a} + {b} = {a + b}, not {value} "));C# 15 language features retained
Zero C# keeps the compiler's full static checking. What you keep:
C# 15: unions, extension members, new memory safety rules
Real generics: a specialised copy for each type, with s [stored copy trimmed 3355 chars]
This story was first published by TechWhoKnows on 22 November 2026. Original: https://techwhoknows.com/tech/zero-c-compiles-c-to-native-code-with-no-runtime-or-garbage-collector
Sources
- 1Zero C# project siteonurgumus.github.io
- 2GitHub repositorygithub.com
- 3Hacker News Show HN discussionnews.ycombinator.com