This article provides a brief explanation and overview of memory allocationand limits in Microsoft Windows version 3.1. This article is not intendedto be a exhaustive explanation of the subject; it is intended to be anoverview only.
This information applies to Microsoft Windows version 3.1 and may not applyto future versions of Windows.
Microsoft Windows version 3.1, in both standard and 386 enhanced mode,allocates the memory that it uses from the XMS driver. The only exceptionoccurs when you run Windows in standard mode because standard mode Windowscan allocate memory from a Virtual Control Program Interface (VCPI)provider (server) or a DOS Protected Mode Interface (DPMI) provider. Pleasenote that standard mode has this capability, but 386 enhanced mode doesnot.
Memory Limits Imposed by Memory Managers
The XMS driver shipped with Windows 3.1 is HIMEM.SYS version 3.07, but anyother XMS driver that conforms to the XMS 2.x or 3.x XMS providerspecifications should work just as well. HIMEM.SYS XMS 2.x drivers shippedwith Windows 3.0 and MS-DOS 5.0 impose a 16 MB memory limit and do not makememory above the 16 MB bus address available through XMS memory calls.
If Windows 3.1 is run with an earlier HIMEM.SYS XMS driver from Windows 3.0or MS-DOS 5.0, then Windows 3.1 cannot use memory above 16 MB. You mustupgrade the XMS driver to the new one shipped with Windows 3.1 to eliminatethis 16 MB barrier.Windows 3.0 does not support memory above 16 MB limitation in both standardand enhanced mode, and relies on the XMS driver to enforce this limit. This16 MB limit does not apply to Windows 3.1.
Memory Limits Imposed by Windows 3.1
The memory limit for Windows 3.1 has been reported as 512 MB. This limit,while technically correct, does need some qualification. This limit appliesonly to Windows running in standard mode. The limit for 386 enhanced modeis 256 MB. This number is a sum of both physical and virtual memory. Thestated 512 MB limit of standard mode Windows is only theoretically possibleand is not practical. In practice, the limit on standard mode Windows isthe same as the 386 enhanced mode limit of 256 MB. This information doesnot apply to computers using a 80286 processor. This processor isphysically limited to accessing only 16 MB.
Windows 3.1 does not use the extended XMS 3.0 capabilities of an XMS 3.0driver. This does not place any limit on the ability of Windows to allocateavailable XMS memory. The only additional capability provided by an XMS 3.0memory manager is the ability to allocate and manipulate a single XMSmemory block larger than 64 MB. This does NOT place a 64 MB limit onoperating systems or applications that use XMS 2.x calls to allocate memoryfrom an XMS 3.0 driver. The result is, an XMS 2.x allocator has to allocatemultiple blocks of XMS memory, each not greater than 64 MB, to access allof the memory on machines with more than 64 MB of memory. Windows does thisin both standard and 386 enhanced mode.
The reason the 512 MB limit for standard mode is not practical can best beexplained by looking at where this number actually comes from. On the 286and 386 CPUs there is a system object that is called the local descriptortable (LDT). This data structure is used to set up the addressing of almostall of the Windows usable memory in the system. This table has room for8096 descriptors. Each of these descriptors, in turn, can address up to 64Kof memory. The 512 MB value is determined by multiplying the size of thenumber of possible descriptors by each descriptors maximum size.
8096k * 64K = 512 MB
To reach 512 MB, every descriptor in the LDT has to be the maximum possiblesize of 64K. In a typical Windows system, the average descriptor size ismuch smaller. The average descriptor size is probably 32K. This yields alimit half as big: 256 MB.
The 256 MB limit of 386 enhanced mode Windows 3.1 is a limit of totalphysical memory and total virtual memory. Normally the total amount ofvirtual memory is four times as much as the total amount of physical memorythat Windows can access. Because both of these items are limited to 256 MB,the following is generally true:
Total Physical Usual Virtual Actual VirtualMemory in MB Memory in MB Memory in MB-------------- ------------- -------------- 4 16 16 8 32 32 16 64 64 32 128 128 64 256 256 128 512 256 256 1024 256
The actual virtual memory size stays at 256 MB once you reach 64 MB oftotal physical memory, and never gets any bigger.
Note that in the preceding paragraph, physical memory is referred to as"total physical memory." This is because this 256 MB limit is purely alimit on the total AMOUNT of physical memory. This limit has nothing to dowith the location on the machine bus of the memory (the memory's address).This distinction is important because on many "large memory" machines, thephysical memory is not all in one contiguous block.
This means that for Windows 3.1 running in standard mode, the limit for themaximum usable physical memory address is 4096 MB; the limit for 386enhanced mode is 2044 MB.