-
Notifications
You must be signed in to change notification settings - Fork 20
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
#265 Update MemoryMappedPageManager memory mapped initiation #388
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,11 +61,9 @@ public unsafe MemoryMappedPageManager(long size, byte historyDepth, string dir, | |
_file = new FileStream(Path, FileMode.Open, FileAccess.ReadWrite, FileShare.None, 4096, | ||
PaprikaFileOptions); | ||
} | ||
_mapped = MemoryMappedFile.CreateFromFile(_file, null, 0, MemoryMappedFileAccess.ReadWrite, HandleInheritability.None, true); | ||
|
||
_mapped = MemoryMappedFile.CreateFromFile(_file, null, (long)size, MemoryMappedFileAccess.ReadWrite, | ||
HandleInheritability.None, true); | ||
|
||
_whole = _mapped.CreateViewAccessor(); | ||
_whole = _mapped.CreateViewAccessor(0, historyDepth * Page.PageSize); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we introduce a new variable called _viewAccessor for accessing the memory mapped portion as a pointer. And use _whole as it is for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not following. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You mean, inside the ForceFlush method, we can get another accessor for _file that covers the whole file and flush it? |
||
_whole.SafeMemoryMappedViewHandle.AcquirePointer(ref _ptr); | ||
_options = options; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK, the mapping will get size from the
_file
, but if the file is just created, it won't work as expected as one will need to set the length. I don't understand how this should work.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if we remove this line -
_file.setLength(size);
while creating a new file. We can set it to some safe initial size.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how to answer. We may do all the things as long as the file is properly mapped and written and flushed 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you recommend -
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Scooletz What do you think about this approach?