I am trying to cache a large amount of data in physical memory and share it for other processes in the local environment. So I came up with MMF and read the Microsoft MMF document, saw some examples, and started setting up similar code.
MemoryMappedFile MMF = MemoryMappedFile.CreateNew("Features", MaxSize); . . . using (MemoryMappedViewStream stream = MMF.CreateViewStream()) { BinaryWriter write = new BinaryWriter(stream); . . . // Fetched the data from database and store it into Rowdata variable. while (Rowdata.Read()) { byte[] data = Rowdata.GetFieldValue<byte[]>(0); write.Write(data); } }
It does not store data in memory
IVSSharedMemory is what I am working on, but the amount of memory should be much higher than that.

Is there something I forgot to do when I created a memory mapping file? please tell me if there is any. I googled it right after I noticed this unexpected behavior, and some said it was virtual memory. But I cannot help but think that this is not true, because the document explains this in the section below.
Inconsistent display files
The CreateNew and CreateOrOpen methods create a memory-mapped file that does not map to an existing file on disk.
Thanks in advance. Just confirmed that this is what the MMF is for.
UPDATE
It seems to be really virtual memory. As Mike Z commented, I checked the memories that my application stored in the VMMAP tool, and as a result I got exactly what I wanted.

But look at this, the amount of allocated memory has changed. This happens when my application downloads all the data completely. I can assume that the previous size just points to the MaxSize that I assigned when creating the MMF.

Did it take up physical disk space or something?
I read a lot about MemoryMappedFile and tried to see what was underground. But I still do not understand why this is happening. Seriously, where is the data? where can i check this?
c # shared-memory mmf
hina10531
source share