From d4ff6548a09891857e09005779fb550c91ce3440 Mon Sep 17 00:00:00 2001 From: Shubham Sonthalia Date: Tue, 10 Sep 2024 09:22:50 +0530 Subject: [PATCH] Update MemoryMappedPageManager memory mapped initiation --- src/Paprika/Store/PageManagers/MemoryMappedPageManager.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Paprika/Store/PageManagers/MemoryMappedPageManager.cs b/src/Paprika/Store/PageManagers/MemoryMappedPageManager.cs index 36151c92..3cd6dfd5 100644 --- a/src/Paprika/Store/PageManagers/MemoryMappedPageManager.cs +++ b/src/Paprika/Store/PageManagers/MemoryMappedPageManager.cs @@ -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); _whole.SafeMemoryMappedViewHandle.AcquirePointer(ref _ptr); _options = options;