Page 1 of 1

Memory mapped files?

PostPosted: Fri Dec 17, 2010 10:13 am
by maybnxtseasn
msdn is quite confusing and im wondering if anyone could explain simply how memory mapped files differ from other approaches of reading bytes of a file on disk? -thx

Re: Memory mapped files?

PostPosted: Sun Dec 19, 2010 7:58 am
by L. Spiro
When using memory-mapped files, when you access the RAM that has been mapped, the access operation (read or write) is redirected to the hard drive, specifically to the file that has been mapped.
Reading from a mapped virtual address in RAM means you are actually reading from your hard drive. Modifying that RAM will modify the file on your hard drive.

Because of this unique association between RAM and your hard drive, there are many restrictions on how memory-mapping can work. For example, page alignments etc.


L. Spiro