dotnet / dotnet/runtime

MemoryMappedFile Add some method or mechanism to refresh the underlying file size.

Open
#129,940 6 comments 0 reactions 0 assignees View on GitHub
area-System.IO needs-further-triage
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

I have need of mapping a file who's size might change as another process modifies or appends it. As such, when it does change, I'd like the ability to refresh the `MemoryMappedFile` cached file size, as there's currently no way to do so without disposing of the current object and creating a fresh one with `MemoryMappedFile.CreateFromFile()` at present.

Current behavior is that `MemoryMappedFile` caches the size of the file, and gives no method of updating it, automatically or otherwise.

This is of course specifically for maps backed by a file on disk, and does not apply to any other map types.

Contributor guide

Open the contributing guide

Research direction

Start by examining the MemoryMappedFile API and the CreateFromFile path described in the issue, focusing on how the file size is cached for maps backed by disk files. Done should provide a documented way to refresh that size without disposing and recreating the MemoryMappedFile, while leaving other map types unaffected.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.