When to use memory-mapped files?

前端 未结 3 1362
日久生厌
日久生厌 2020-12-08 06:48

I have an application that receives chunks of data over the network, and writes these to disk. Once all chunks have been received, they can be decoded/recombined into the si

3条回答
  •  情话喂你
    2020-12-08 07:00

    I'd say both cases are relevant. Simply write the single chunks to their proper place in the memory mapped file, out of order, as they come in. This of course is only useful if you know where each chunk should go, like in a bittorrent downloader. If you have to perform some extra analysis to know where the chunk should go, the benefit of a memory mapped file might not be as large.

提交回复
热议问题