.net - .NET GC 的标记和清理阶段如何与应用程序线程同时运行?

标签 .net garbage-collection

.NET GC 的标记和清除阶段如何与应用程序线程同时运行?

最佳答案

我不确定。根据 Maoni Stephens blog .

During a concurrent GC we need to suspend managed threads twice to do some phases of the GC.

她没有详细说明这些阶段。

同样来自词条

Concurrent GC, on the other hand, runs concurrently with the managed threads to the following extend:

§ It allows you to allocate while a concurrent GC is in progress.

However you can only allocate so much – for small objects you can allocate at most up to end of the ephemeral segment. Remember if we don’t do an ephemeral GC, the total space occupied by ephemeral generations can be as big as a full segment allows so as soon as you reached the end of the segment you will need to wait for the concurrent GC to finish so managed threads that need to make small object allocations are suspended.

§ It still needs to stop managed threads a couple of times during a concurrent GC.

During a concurrent GC we need to suspend managed threads twice to do some phases of the GC. These phases could possibly take a while to finish. We only do concurrent GCs for full GCs. A full GC can be either a concurrent GC or a blocking GC. Ephemeral GCs (ie, gen0 or gen1 GCs) are always blocking. Concurrent GC is only available for workstation GC. In server GC we always do blocking GCs for any GCs.

您可能还对 this video 感兴趣.

关于.net - .NET GC 的标记和清理阶段如何与应用程序线程同时运行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4454291/

相关文章:

c# - 捕获 C# 2.0 中作为类型参数给出的异常类型

java 垃圾回收和临时对象

C# 将 FILE STREAM 传递给 EXE 文件

macos - 我可以在非 cocoa 程序上使用苹果垃圾收集器吗?

garbage-collection - 二郎垃圾回收

java - 了解 GC 失败消息

Java垃圾回收: what is virtual space in parallel collector?

.net - .NET Core 准备好在 Raspberry PI 3 上运行了吗?

c# - 无法定义使用 'dynamic' 的类或成员,因为编译器需要类型 'System.Runtime.CompilerServices.DynamicAttribute'

c# - 作为 Windows 服务运行时出现 "Win32Exception Not enough storage is available to process this command"错误