Remix.run Logo
cachius 7 hours ago

A recent superpower was added by Fil aka the pizlonator who made C more Fil-C with FUGC, a garbage collector with minimal adjustments to existing code, turning it into a memory safe implementation of the C and C++ programming languages you already know and love.

https://news.ycombinator.com/item?id=45133938

https://fil-c.org/

6 hours ago | parent | next [-]
[deleted]
mk89 4 hours ago | parent | prev | next [-]

Thank you so much for sharing this. I missed the HN post.

This is beautiful!

762236 6 hours ago | parent | prev [-]

Why would I want to run a garbage collector and deal with it's performance penalties?

jerf 6 hours ago | parent | next [-]

Because about 99% of the time the garbage collect is a negligible portion of your runtime at the benefit of a huge dollop of safety.

People really need to stop acting like a garbage collector is some sort of cosmic horror that automatically takes you back to 1980s performance or something. The cases where they are unsuitable are a minority, and a rather small one at that. If you happen to live in that minority, great, but it'd be helpful if those of you in that minority would speak as if you are in the small minority and not propagate the crazy idea that garbage collection comes with massive "performance penalties" unconditionally. They come with conditions, and rather tight conditions nowadays.

hypeatei 5 hours ago | parent | next [-]

I think these threads attract people that write code for performance-critical use cases which explains the "cosmic horror" over pretty benign things. I agree though: most programs aren't going to be brought to their knees over some GC sweeps every so often.

jvanderbot 40 minutes ago | parent | next [-]

I think these threads attract people like that, but also people that want to be like that. I've seen a lot of people do "rigor theater", where things like reproduce-able builds, garbage collection, or, frankly, memory safety are just thought terminating cliches.

KerrAvon 4 hours ago | parent | prev [-]

Outside of hobbyist things, performance-critical code is the only responsible use case for a non-memory safe language like C in 2025, so of course it does. (Even that window is rapidly closing, though; languages like Rust and Swift can be better than C for perf-critical things because of the immutability guarantees.)

sramsay 30 minutes ago | parent | next [-]

I keep hearing this, but I fail to see why "the massive, well-maintained set of critical libraries upon which UNIX is based" is not a good reason to use C in 2025.

I have never seen a language with a better ffi into C than C.

lelanthran an hour ago | parent | prev [-]

> Outside of hobbyist things, performance-critical code is the only responsible use case for a non-memory safe language like C in 2025, so of course it does.

Maybe; I sometimes write non-hobbyist non-performance-critical code in C.

I'm actually planning a new product for 2026 that might be done in C (the current iteration of that product line is in Go, the previous iteration was in Python).

I've few qualms about writing the server in C.

Phil_Latio 5 hours ago | parent | prev | next [-]

> Because about 99% of the time the garbage collect is a negligible portion of your runtime

In a system programming language?

jerf 3 hours ago | parent | next [-]

Whether or not GC is a negligible portion of your runtime is a characteristic of your program, not your implementation language. For 99% of programs, probably more, yes.

I have been working in GC languages for the last 25 years. The GC has been a performance problem for me... once. The modal experience for developers is probably zero. Once or twice is not that uncommon. But you shouldn't bend your entire implementation stack choice over "once or twice a career" outcomes.

This is not the only experience for developers, and there are those whose careers are concentrated in the places where it matters... databases, 100%-utilization network code, hardware drivers. But for 99% of the programs out there, whatever language they are implemented in, GC is not an important performance consideration. For the vast bulk of those programs, there is a much larger performance consideration in it that could be turned up in 5 minutes with a profiler and nobody has even bothered to do that and squeeze out the accidentally quadratic code because even that doesn't matter to them, let alone GC delays.

This is the "system programmer's" equivalent of the web dev's "I need a web framework that can push 2,000,000 requests per second" and then choosing the framework that can push 2,001,000 rps over the one that can push 2,000,000 because fast... when the code they are actually writing for the work they are actually doing can barely push 100 rps. Even game engines nowadays have rather quite a lot of GC in them. Even in a system programming language, and even in a program that is going to experience a great deal of load, you are going to have to budget some non-trivial optimization time to your own code before GC is your biggest problem, because the odds that you wrote something slower than the GC without realizing it is pretty high.

Phil_Latio 2 hours ago | parent [-]

> Whether or not GC is a negligible portion of your runtime is a characteristic of your program, not your implementation language.

Of course, but how many developers choose C _because_ it does not have a GC vs developers who choose C# but then work around it with manual memory management and unsafe pointers? ....... It's > 1000 to 1

There are even new languages like C3, Odin, Zig or Jai that have a No-GC-mindset in the design. So why you people insist that deliberately unsafe languages suddenly need a GC? There a other new languages WITH a GC in mind. Like Go. Or pick Rust - no GC but still memory safe. So what's the problem again? Just pick the language you think fits best for a project.

Snarwin 5 hours ago | parent | prev | next [-]

There's plenty of application-level C and C++ code out there that isn't performance-critical, and would benefit from the safety a garbage collector provides.

jvanderbot 39 minutes ago | parent [-]

Right, does `sudo` net benefit from removal of heap corruption, out of bounds, or use after free, etc errors that GC + a few other "safeties" might provide? I think so!

pjmlp 5 hours ago | parent | prev [-]

Yes, plenty have been done already so since Lisp Machines, Smalltalk, Interlisp-D, Cedar, Oberon, Sing#, Modula-2+, Modula-3, D, Swift,....

It is a matter to have an open mindset.

Eventually system languages with manual memory management will be done history in agentic driven OSes.

KerrAvon 4 hours ago | parent [-]

Swift, by design, does not have GC.

pjmlp 3 hours ago | parent | next [-]

Chapter 5,

https://gchandbook.org/contents.html

It would help if all naysayers had their CS skills up to date.

pebal 3 hours ago | parent | prev [-]

RC is a GC method and the least efficient one.

5 hours ago | parent | prev | next [-]
[deleted]
762236 5 hours ago | parent | prev [-]

For new projects, I just use Rust: there is zero reason to deal with a garbage collector today. If I'm in C, it's because I care about predictable performance, and why I'm not using Java for that particular project.

greenavocado 4 hours ago | parent [-]

https://docs.rs/gc/latest/gc/

bigstrat2003 2 hours ago | parent | next [-]

Not really sure what relevance a third party library has when discussing the language characteristics.

762236 4 hours ago | parent | prev [-]

I don't understand. This is an optional part of Rust. I'm obviously not using a garbage collector in Rust.

sesm 5 hours ago | parent | prev | next [-]

IDK about Fil-C, but in Java garbage collector actually speeds up memory management compared to C++ if you measure the throughput. The cost of this is increased worst-case latency.

A CLI tool (which most POSIX tools are) would pick throughput over latency any time.

zozbot234 4 hours ago | parent | next [-]

You also pay for the increased throughput with significant memory overhead, in addition to worst-case latency.

KerrAvon 4 hours ago | parent [-]

This. The memory overhead kills you in large systems/OS-level GC. Reducing the working set size really matters in a complex system to keep things performant, and GC vastly expands the working set.

In the best cases, you’re losing a huge amount of performance vs. an equivalent non-GC system. In the worst, it affects interactive UI performance with multi-second stalls (a suitably modern GC shouldn’t do this, though).

dataflow 4 hours ago | parent | prev | next [-]

> in Java garbage collector actually speeds up memory management compared to C++ if you measure the throughput

If I had a dollar for every time somebody repeated this without real-world benchmarks to back it up...

wavemode 3 hours ago | parent | prev | next [-]

Java (w/ the JIT warmed up) could possibly be faster than C++, if the C++ program were to allocate every single value on the heap.

But you're never going to encounter a C++ program that does that, since it makes no sense.

CyberDildonics 4 hours ago | parent | prev [-]

I see this claim all the time without evidence, but it's also apples and oranges. In C++ you can avoid heap allocations so they are rare and large. In java you end up with non stop small heap allocations which is exactly what you try to avoid when you want a program to be fast.

Basically java gc is a solution to a problem that shouldn't exist.

palata 6 hours ago | parent | prev [-]

Easy: because in your specific use-case, it's worth trading some performance for the added safety.

762236 5 hours ago | parent [-]

If I'm in C, I'm using JNI to work around the garbage collector of Kava

palata 5 hours ago | parent [-]

Have you ever measured the performance impact of JNI? :-)