4 ms·
You can do some weird stuff to GC in C#. I haven't looked at it in several years, but I'm pretty sure there's a way to suspend GC at runtime. There's definitely
by rolenthedeep 4y ago
You can do some weird stuff to GC in C#. I haven't looked at it in several years, but I'm pretty sure there's a way to suspend GC at runtime. There's definitely a mechanism to force immediate GC, and functions to exempt an object from GC.
C# is a lot more flexible than people give it credit for, I've seen some absolutely amazing things built this way. Of course, manipulating C# in unexpected ways is an absolute nightmare, but with enough determination you can do about anything
- TideAd 4y agoI believe you can be notified when a collection is imminent. I saw a service use that to remove instances from the load balancer before that happened - super useful for higher-percentile latencies.
- bob1029 4y agoI looked into all of this, and still have a use case where it doesn't quite work out as well as it could with Java. I can almost make it work with some pretty aggressive hackarounds, such as subdividing my service into multiple, smaller processes that each operate w/ workstation GC mode. GC runs pretty fast when object count is reasonable. Something like 1 process per latency-sensitive client is where I am at with .NET right now.