Skip to content

Conversation

shjin404
Copy link
Contributor

The view size cannot be smaller than mapped file size. It is just getting rounded up by page size which is normally 4kb.

Summary

Describe your changes here.

Fixes #Issue_Number (if available)

The view size cannot be smaller than mapped file size. It is just getting rounded up by page size which is normally 4kb.
@dotnet-bot dotnet-bot added this to the May 2020 milestone May 28, 2020
@shjin404
Copy link
Contributor Author

From dev comment found from github,

When MemoryMappedFileOptions.DelayAllocatePages option is used, the view size can be smaller than the mapped file size if memory is not committed. Should this be added as a comment to make this better?

https://github.com/dotnet/runtime/blob/4f9ae42d861fcb4be2fcd5d3d55d5f227d30e723/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedView.Windows.cs#L51-L60

@gewarren
Copy link
Contributor

@carlossanlop @jozkee Can you review this PR?

@gewarren gewarren requested a review from jozkee July 21, 2020 21:48
@jozkee jozkee requested a review from carlossanlop July 23, 2020 07:00
Copy link
Member

@jeffhandley jeffhandley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shjin404 Sorry this sat for so long. Thank you for making this improvement. I validated the behavior of rounding up based on the source here: https://github.com/dotnet/runtime/blob/master/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedView.Windows.cs#L20-L25

@jeffhandley jeffhandley merged commit 803e3e5 into dotnet:master Feb 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants