1

I am having a piece of software that is using MMF that is backed up by the system page file. The application uses MMF in order to cache large images. Write and read operations are happening at a very high frequency.

Though I can clearly see the performance boost of using MMF , I am still wondering what is a better approach , to map the MMF to a regular file , or to map to the system page file.

I am wondering whether anyone here can provide some insights about this , what would be better map it to the system page file or just to another file?

Note : my question is NOT about MMF in general , I am not wondering whether to use MMF or not , I am just wondering to where the MMF should be mapped.

Any insights about that?

Yossi
  • 87
  • 7

1 Answers1

2

The underlying mechanism and performance is the same, the main difference is that you are sharing the page file with all other processes in the system, so if you have a large amount of data you may run up against the size limit of the page file.

Jonathan Potter
  • 36,172
  • 4
  • 64
  • 79
  • 1
    Another difference would be that mapping a real file, unless you use `FILE_ATTRIBUTE_TEMPORARY`, will touch the disk wereas a MMF backed by the page file will not, unless you run low on physical memory. That, and the file is world-visible (which is usually not a problem). – Damon Jan 09 '13 at 11:13
  • damon , your grammar is a bit confusing for me (english not my native) . can you please write it more clearly? thanks. – Yossi Jan 09 '13 at 12:14
  • 1
    A MMF maps memory pages from an underlying file to memory pages. Pages that you modify are marked dirty and are flushed to disk. The same happens when you close a mapping. Sometimes you don't want that, for example if you know you will delete the file anyway. Only if you open with `FILE_ATTRIBUTE_TEMPORARY` this is not automatically done. However, when a MMF is backed by the page file, pages are also only written to disk when necessary, i.e. if they are swapped out (when they are not currently in the active process' working set _and_ there is not enough physical RAM for everyone). – Damon Jan 09 '13 at 14:59