2
votes

According to Msdn :

Memory-mapped files enable programmers to work with extremely large files because memory can be managed concurrently, and they allow complete, random access to a file without the need for seeking

question :

the whole principle of Memory Mappe File is to write/read bytes , and create views by location and offset.

What does it mean "NO need for seeking" ?

I MUST know the start and the end ( offsets) in order to read a file.

So seeking DOES EXISTS !

I Do seek in this huge array of bytes....

What am i missing ?

3

3 Answers

3
votes

When using memory mapped files you basically get a pointer to a block of memory and access it as an array of some type. Then accessing specific locations in the file is index and/or offset based access to memory. The OS manages the seeking needed invisibly behind.

2
votes

A MMF has random-access, in contrast with a normal file where there is 1 specific point where reading or writing occurs.

Using offsets (and pointers etc) is not the same as seeking in a stream.

I MUST know the start and the end ( offsets) in order to read a file

You don't 'read a file', you access memory and need address(es), not a stream-position.

1
votes

MMF are the files actually "mapped" to virtual memory space, so you can think of it like (very generalistic comparison) of Dictionary in regard of Array. It's comfortable (if not say only possible) solution when dealing with very big files by acessing chunks of that file to proceed. I would say that, may be, every video editing software uses this technology. No other way to do.