https://github.com/dotnet/runtime/issues/9199
GC reserves a continuous range of virtual memory for the heap. Actual allocations from that heap then just commit segments of that virtual memory. The GC heap needs to be in a continuous range of virtual memory so that we can quickly find if an address belongs to the heap or not. GC code maintains g_lowest_address and g_highest_address global variables that represent the GC heap range. If we didn't reserve a virtual memory range at once, there would be no guarantee of continuous space where only GC heap can live.
- GC 保留了堆里面的虚拟内存的一个连续范围。
- 从堆里面的真实分配里提交虚拟内存的已提交的段。
- GC 堆需要是虚拟内存的一个连续范围,以便可以快速定位到这个地址是不是属于堆的。
- GC 代码维护了 g_lowest_address 和 g_highest_address 的全局变量 用来反应 GC 的堆范围 。
- 一旦如果我们不保留一个虚拟内存的范围,我们将无法保证 GC heap 所在的连续空间存活。