Is it possible to block GC?

We can.

  • for some critical part of application code using GC.TryStartNoGCRegion method.
  • using CER (Constrained Execution Regions)
  • with GC LatencyModes

Further read:

https://learn.microsoft.com/en-us/dotnet/api/system.gc.trystartnogcregion?redirectedfrom=MSDN&view=net-6.0#overloads

https://learn.microsoft.com/en-us/dotnet/framework/performance/constrained-execution-regions?redirectedfrom=MSDN

https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/latency?redirectedfrom=MSDN

Leave a Reply

Your email address will not be published. Required fields are marked *

Solve : *
4 + 7 =