dotnet / dotnet/runtime

Investigate prefetching PE file data into pinned managed memory.

Open
#132,312 3 comments 0 reactions 0 assignees View on GitHub
area-System.Reflection.Metadata tenet-performance untriaged
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

dotnet/roslyn#24939 describes a situation where creating `PEReader`s with `PEStreamOptions.PrefetchEntireImage` leads to OOMs due to large native allocations that the GC cannot keep track of.

I wonder if it would be better to instead allocate the prefetched data in managed memory and later pin it, akin to how `PEReader(ImmutableArray)` works. If so, we can make use of the Pinned Object Heap on modern .NET; the question is whether to keep using native memory on downlevel frameworks, or allocate and pin there as well.

Contributor guide

Open the contributing guide

Research direction

Start by reading dotnet/roslyn#24939 and reviewing the PEReader(ImmutableArray) path alongside PEStreamOptions.PrefetchEntireImage. Compare managed allocation and pinning behavior with the Pinned Object Heap on modern .NET and downlevel frameworks. Done means establishing whether the proposed approach avoids the reported native-memory OOMs and documenting the allocation strategy decision.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.