Lurker News

Comments (137) 32 threads

Earlier comments
buybackoff2 replies#
For C# as is, what I really would appreciate is a frozen GC mode. Not zero GC, similar to Epsilon GC in Java. After initial state loading and forced GC, I would like to be able to apply a SustainedNoGC mode, that just does not even try to collect, no scanning, no pauses at all, it can only allocate. And notifications (an event) after some X bytes allocated, or just a reliable way to monitor the allocated size. The existing modes such as SustainedLowLatency or NoGCRegion are good but not enough. For some low latency workloads it's OK to allocate many GBs and then pause explicitly.

Random forced pauses are the only problem that comes from GC, otherwise it's great for throughput and just a nice feature, as a sibling comment says. No GC languages do not make code magically faster, they still have malloc/free. However, GC is surrendering control over when a program may be paused.

ablob1 reply#
Can't you just initialize and then do a NoGCRegion? It would give you everything except the monitoring I think.
buybackoff1 reply#
It does not work the way I described. It is only for short periods and is not a guarantee, and has overheads for repeated calls.
jasomill2 replies#
.NET has supported custom garbage collectors for many years, so if you're willing to accept that all heap-allocated objects will live as long as your process, implementing a no-op garbage collector should be a straightforward exercise.

Continue this thread — 2 replies

to11mtm1 reply#
TBH, at least in my head, I feel like what it needs more is a 'string-ish type that can be used in a pool'.

With Pooling/Arenas already semi-established, you can do lots of stuff with pools/arenas. Where the challenge comes, is how much of Corelib (and normal apps) use strings in places, and you can't get around that without a lot of DIY. The "foostring" u8 const conversion helps for some cases but doesn't cover nearly enough cases.

buybackoff#
What about Span over char[]? Or a tiny struct wrapper with the length. Or do you mean some deeper runtime support?
andix1 reply#
Assuming this is very similar to bflat: it's a cool idea and fun to play with, but not very useful. C# is not designed to run without a GC, existing code usually won't run, because the standard library is missing.

Just using C, Rust, Zig, or whatever is probably nearly always the better option. Those languages are designed to work without GC and provide various well established ways to manage memory.

Alifatisk1 reply#
It says on the website "A fork of bflat"
andix#
I know, but I didn't take a closer look at the differences to bflat. I just assumed they are still quite similar.
Dwedit1 reply#
You really don't want to use C# with the "Bflat/Zero" runtime library. Even something very basic like strings is unsupported. It becomes C code with funny syntax that doesn't align well with the language.

I have not yet tested out Beef, but it seems to be more in line with what you'd want from a native C#-like language.

reverseblade2#
Author here, strings are supported.
pmkary#
I looked for DLL support and found nothing. The standard library is also different from C#, and you have to manage memory on your own. Sadly I don't get the point. People code in C# for the .NET and its huge library, unless this is not a drop in replacement, you have to port your whole codebase; well then people will write Rust already...

Load more comments