Virtual address space usage in a Windows Vista gaming Environment...

Some of our more astute users may have noticed that memory is allocated differently under Windows Vista - especially with reference to virtual memory related to Video graphics cards. Windows Vista, applications run within their own private virtual address space. Most of the time, the size of the virtual address space is fixed at 2 gigabytes (GB) for 32-bit applications. Don't be confused here - the virtual address space available is not related to how much physical memory there is on the computer.

Every memory allocation, file mapping, or library that is loaded by an application consumes space in this virtual address space. When the application consumes all its virtual address space, any additional such operations fail. Although all applications should be coded to handle memory allocation failures, many applications do not recover correctly from such failures. Therefore, the programs may become unstable or stop responding after they recover from such failures.

Existing games and other graphics applications frequently allocate virtual memory for a copy of the video memory resources that the application uses. The application uses this copy to restore the display quickly if the contents of video memory are lost. For example, the application uses this copy if the user presses ALT+TAB or if the user puts the computer in standby. Typically, the DirectX run time manages the copy on behalf of the application when the application creates a managed resource. However, an application can also manage the copy itself. The virtual memory that the copy uses is directly proportional to the video memory resources that the application allocates.

A modern graphics processing unit (GPU) can have 512MB (or more) of video memory. Applications that try to take advantage of such large amounts of video memory can use a large proportion of their virtual address space for an in-memory copy of their video resources. On 32-bit systems, such applications may consume ALL of the available virtual address space.

So the change we are alluding to is that with the introduction of DirectX 10 and Windows Display Driver Model (WDDM) in Windows Vista, it is no longer necessary for an application to maintain a copy of its resources in system memory. Instead, the video memory manager makes sure that the content of every video memory allocation is maintained across display transitions. For compatibility reasons, Windows Vista emulates "device lost" for DirectX versions that are earlier than DirectX 10 to make sure that no application-visible API behavior changes.

To virtualize video memory, the video memory manager in Windows Vista assigns a virtual address range to every video memory resource. This range is conceptually similar to the copy that an application might create. However, the video memory manager manages the process more efficiently than the application might. The video memory manager uses the virtual address range to handle transitions or over-commitment of video memory. However, the virtual address range is typically unused on a system that has lots of video memory. As long as this virtual address range remains unused, no physical memory is allocated for it. In contrast, the system memory copy that is maintained in the older driver model is guaranteed to be fully populated with physical memory.

If an application creates its own in-memory copy of its video resources or the application uses DirectX 9 or an earlier version, the virtual address space contains the WDDM video memory manager's virtualized range and the application's copy. Applications that use graphics APIs that are earlier than DirectX 10 and that target GPUs that have large amounts of video memory can easily exhaust their virtual address space on 32-bit machines.

To address this problem, Microsoft has changed the way that the video memory manager maintains the content of video memory resources. This change is being made so that a permanent virtual address range does not have to be used for each virtualized allocation. With the new approach, only allocations that are created as "lockable" consume space in the virtual address space of the application. Allocations that are not created as "lockable" do not consume space. This approach significantly reduces the virtual address space that is used. Therefore, the application can run on large video memory configurations without reaching the limits.

Although this approach reduces virtual address consumption, it does not eliminate the 2GB virtual address space limit that many applications are quickly approaching on their own. Eventually, applications will reach the limit for other reasons.

For further reading see the following URL:
https://www.microsoft.com/whdc/device/display/WDDM_VA.mspx