How to dynamically expand a Memory Mapped File

后端 未结 5 1927
星月不相逢
星月不相逢 2020-12-09 08:16

I\'ve used C# to solve the following requirement.. - create an app the can receive a lot of data fast - you must be able to analyse the received data while more are incoming

5条回答
  •  天命终不由人
    2020-12-09 08:48

    I found that closing and recreating the mmf with the same name but new size works to all intents and purposes

                    using (var mmf = MemoryMappedFile.CreateOrOpen(SenderMapName, 1))
                    {
                        mmf.SafeMemoryMappedFileHandle.Close();
                    }
                    using (var sender = MemoryMappedFile.CreateNew(SenderMapName, bytes.Length))
    
    

    and it's really fast.

提交回复
热议问题