Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid mapping the metadata file more than once #529

Merged
merged 3 commits into from
Apr 12, 2022
Merged

Avoid mapping the metadata file more than once #529

merged 3 commits into from
Apr 12, 2022

Conversation

AArnott
Copy link
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

@AArnott AArnott added the bug Something isn't working label Apr 12, 2022
@AArnott AArnott merged commit 17a7887 into main Apr 12, 2022
@AArnott AArnott deleted the fixMemory branch April 12, 2022 19:54
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.

None yet

1 participant