Windows memory management

This article covers the core concepts of Windows memory management and describes how Windows applications are isolated to prevent an application affects negatively the memory used by other applications.

Virtual Memory

Virtual memory has this name because it is a logical representation of memory provided by the operating system for the processes, which are not necessarily mapped to physical memory. The following figure displays two virtual address areas allocated to each of the two processes. Note that a virtual memory allocation may not reside in physical memory, as well as the area of physical memory can be common for allocations in virtual memory (this is the case of common DLLs between two processes). In this case, the shared area physically is just the DLL binary.

 

 

The size of the virtual address space of a process depends on the architecture of the operating system (32 or 64-bit) and process architecture (32 or 64-bit), as:

 

 

It is important to be aware of the use of the memory areas, observing the current value and the limit, because when the values are approaching the limit, the operating system, as well as, the processes may become unstable and will generate errors when basic operations are performed.

 

NOTE: A Portuguese version of this article is available at: https://blogs.msdn.com/b/luisdem/archive/2015/12/29/gerenciamento-de-mem-243-ria-do-windows.aspx