MemoryOwner docs should have a warning about the maximum supported length
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 1/5
- Thời gian dự kiến
- Dưới một giờ
- Mức phù hợp với người mới
- 52/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- csharp
- Lĩnh vực
- documentation
Hướng nghiên cứu
Đọc docs/high-performance/MemoryOwner.md và xem xét lại hướng dẫn về MemoryOwner cùng với hành vi của API được liên kết. Thêm cảnh báo rằng ArrayPool.Shared chỉ hỗ trợ các mảng được pool có tối đa 2^20 phần tử, đồng thời giải thích rằng các cấp phát lớn hơn nên sử dụng Allocate với một ArrayPool có kích thước phù hợp. Hoàn thành khi giới hạn và phương án thay thế đã rõ ràng đối với người đọc.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hi,
I'm new to the CommunityToolkit and was looking how the MemoryOwner<T> can help me to improve my code. A normal use case for me is working with monochrome camera image and therefore I need often large byte arrays. If I get the implementation right, the MemoryOwner<T> uses an ArrayPool<T> which is created from the ArrayPool<T>.Shared - but this supports only an array length up to 2^20 (1024 * 1024 = 1048576). If a larger array is reqested, it returns only a normal array:
// The request was for a size too large for the pool. Allocate an array of exactly the requested length.
// When it's returned to the pool, we'll simply throw it away.
buffer = GC.AllocateUninitializedArray<T>(minimumLength);
With that, most of the optimizations are gone!
Therefore, I think it is important to also clearly emphasize this point in the documentation. In this case the developer should use the Allocate method which accepts a ArrayPool<T> as an input parameter. This pool could be created with the right size.
Best regard,
Mike
Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.
- ID: 1270690a-737c-ebd1-dcc9-933f7e20290e
- Version Independent ID: 1270690a-737c-ebd1-dcc9-933f7e20290e
- Content: MemoryOwner<T> - .NET Community Toolkit
- Content Source: docs/high-performance/MemoryOwner.md
- Product: dotnet-communitytoolkit
- GitHub Login: @Sergio0694
- Microsoft Alias: joverslu
- Ngôn ngữ chính
- Không có dữ liệu ngôn ngữ
- Star
- 168
- Fork
- 135
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của MicrosoftDocs/CommunityToolkit
-
dotnet-communitytoolkit/svc dotnet-maui-community-toolkit/subsvc Pri2
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 91/100
MicrosoftDocs/CommunityToolkit#651 · 1 bình luận ·
-
Just a typo?Đang mởcommunity-toolkit/prod dotnet Pri2
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 70/100
-
Syntax for Size attributeĐang mởdotnet-communitytoolkit/prod maui Pri1
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
-
dotnet dotnet-communitytoolkit/prod Pri1
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 38/100
MicrosoftDocs/CommunityToolkit#659 · 1 bình luận ·
Tất cả issue của MicrosoftDocs/CommunityToolkit
Issue tương tự
-
documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
fastrevmd-lab/rustmistmcp#161 ·
-
area: cli enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
neondatabase/agent-skills#139 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 70/100
-
2.3 EDA: `np.log` example adds +1 to every value, so it can't produce the `-inf` output shownĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
DataTalksClub/machine-learning-zoomcamp#730 ·
Maintainer thường phản hồi trong vòng 2 ngày