c# - When to use memory-mapped files? -


I have an application that receives part of the data on the network, and writes it on disk. Once all the parts are received, they can actually be decoded / recombined in a file that represents it.

I am wondering if it is useful to use memory-mapped files - to write the first single section

My own feeling is that it is the second case Can anyone find some ideas on this? Edit P: This is a C # app, and I'm just planning a x64 version (hence the 'biggest disputed free space' problem is running in, this The problem should not be relevant)

Memory-map file is beneficial for scenarios where large file files A relatively small portion (view) requires frequent access

In this scenario, the operating system map Only recently used parts of the file can help to optimize paging behavior by using paging throughout the memory usage and application.

In addition, memory-mapped files can expose interesting features such as serving as the basis of copy-on-written or shared-memory.

For your scenario, memory-mapped files can help you gather the file segment out of sequence, however, you will still need to know the final file size in advance.

In addition, you should access files only once to type. Thus, there is no likelihood of the performance benefits that clearly implement the asynchronous I / O, but your file may be easier and faster to implement the author correctly.

In .NET 4, Microsoft added support for memory mapped files and there are some comprehensive articles with sample code, such as


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -