And for static types that can be allocated on a NonGC heap, the same limit of ~64KB applies as also applied for the interned strings. So it is a limitation on the NonGC heap, right?
I believe this is a limitation of the FrozenObjectHeapManager (used by the runtime to allocate in frozen segments) rather than the NonGC heap itself. I looked at the comment in https://github.com/dotnet/runtime/pull/49576 and it really seems like the only explanation is "it's an optimization so let's not bother"
Wait but the book also said for interned strings it is 64K, page 186: "If the size of the literal string is
larger than 64 KB, it wonβt fit into the NonGC heap"
Yeah the wording is unfortunate. It's not that it won't fit, but rather that the allocator used internally by the runtime has this arbitrary limitation.
Comments
grouped by king: POH regions appear first, followed by gen2, gen1, gen0 regions"
I suppose king is a typo for kind.π
https://github.com/dotnet/runtime/blob/main/docs/design/features/NonGC-Heap.md
larger than 64 KB, it wonβt fit into the NonGC heap"