1

There are three memory types, heap, memory mapped files and virtual memory.What is difference between virtual memory and memory mapped files?

  • 1
    Read the documentation: [VirtualAlloc()](http://msdn.microsoft.com/en-us/library/aa366887(v=vs.85).ASPX) vs. [MapViewOfFile()](http://msdn.microsoft.com/en-us/library/windows/desktop/aa366761(v=vs.85).aspx) – WhozCraig Oct 30 '13 at 15:18

2 Answers2

1

MMF can be shared between processes. Virtual memory allocated with VirtualAlloc or VirtualAllocEx is accessible only from one process.

"A memory-mapped file contains the contents of a file in virtual memory. This mapping between a file and memory space enables an application, including multiple processes, to modify the file by reading and writing directly to the memory."

http://msdn.microsoft.com/en-us/library/dd997372.aspx

Motomotes
  • 4,111
  • 1
  • 25
  • 24
0

All of the memory is virtual. VirtualAlloc is a way to allocate some memory in your process. (The heap manager uses it.)

Memory mapped files is a way to allocate some memory that can be used to access a file and can be shared by multiple processes.

ScottMcP-MVP
  • 10,337
  • 2
  • 15
  • 15