dotnet / dotnet-api-docs

.NET API reference documentation (.NET 5+, .NET Core, .NET Framework)
https://docs.microsoft.com/dotnet/api/
Other
702 stars 1.55k forks source link

ArrayPool<T>.Create missing limits #9542

Open RichardD2 opened 8 months ago

RichardD2 commented 8 months ago

ArrayPool<T>.Create(int maxArrayLength, int maxArraysPerBucket)

This documentation makes no mention of any limits on the maxArrayLength parameter. Whilst the fact that this parameter cannot be less than or equal to zero is (probably) self-evident, the source code reveals a further undocumented limit:

Our bucketing algorithm has a min length of 2^4 and a max length of 2^30. Constrain the actual max used to those values.

This limitation should be included in the documentation to avoid confusion, as seen in this Reddit post.

dotnet-issue-labeler[bot] commented 8 months ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.