For an authoritative answer, you'd have to ask the .NET team that designed and implemented Span<T>
. That said…
.NET is fundamentally a 32-bit framework. It supports 64-bit processes, and can allocate from the 64-bit virtual address space. But it has a 2GB limit on objects. This leads to another design choice: collection sizes are 32-bit integers, and they are signed because CLS-compliant code doesn't use unsigned values. These two design choices go together, reinforcing each other.
So, when it comes to Span<T>
, which is intended to provide subsets of existing memory in a managed context, the public interface that the type provides is compatible with CLS requirements. Thus, the Length
property and the indexer parameter both are 32-bit integer types, as well are the parameters to Span<T>
constructors that specify offsets and lengths within the existing memory.
This is consistent with the entire rest of the .NET API, in which arrays and other collections can have no more than 2^32 elements and can be no larger than 2GB.
Additional related reading:
64-Bit VB.NET Allocating > 2GB of RAM (.NET bug?)
How can I know the ACTUAL maximum number of elements a .net array of a given type can be allocated?
BigArray, getting around the 2GB array size limit