Skip to content

Avoid mapping the metadata file more than once#529

Merged
AArnott merged 3 commits intomainfrom
fixMemory
Apr 12, 2022
Merged

Avoid mapping the metadata file more than once#529
AArnott merged 3 commits intomainfrom
fixMemory

Conversation

@AArnott
Copy link
Copy Markdown
Member

@AArnott AArnott commented Apr 12, 2022

When the source generator is invoked concurrently, it would call File.OpenRead for each concurrent use. This maps the file content into memory. Each call gets its own mapped area, and the file will be read once per concurrent use. This ends up taking up lots of memory in some sessions.

In this change, we map the file once and create many streams based on it.

This fixes devdiv-1520804

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant