Is it possible to block GC?

We can.

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

Further read:

https://learn.microsoft.com/en-us/dotnet/api/system.gc.trystartnogcregion?redirectedfrom=MSDN&view=net-7.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

One Reply to “Is it possible to block GC?”

Leave a Reply

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

Solve : *
10 + 22 =