Hacker News new | ask | show | jobs
by pjmlp 1854 days ago
C# has structs and support for native heap management, and as of C# 9 very few features missing versus something like Modula-3 or even D.

You can provide your own GC on .NET via the COM API.

https://github.com/Potapy4/dotnet-coreclr/blob/master/Docume...

Just like Java since version 10, https://medium.com/@unmeshvjoshi/writing-your-own-garbage-co...

1 comments

> C# has structs

And yet so little code uses them that to eschew the builtin GC is to eschew basically the entire .NET framework. Even basic foreach loops go through IEnumerable interfaces - theoretically boxing even structs. They also come with different semantics - sometimes terrfiyingly subtly differences when combined with properties.

> and support for native heap management

IDisposable and friends are awkward fill-ins for proper RAII tools for native heaps.

That said, these options can be incrementally deployed in your existing codebase without resorting to another language, so they're more accessible options

> [links]

Hooking/replacing the GC seems more straightforward these days, than when I last looked into it though! Although, coreclr APIs won't help with Unity, or Mono. OpenJDK is at least used by modern Android these days, so perhaps there's a way to use it's GC customization options...?

Some developers know their stuff,

https://devblogs.microsoft.com/aspnet/grpc-performance-impro...

Others are doomed never to move away from new.