Microsoft KB Archive/67999

INF: Windows Enhanced Mode Allocation Limit 16 MB Minus 64K ID Number: Q67999

3.00 3.00a WINDOWS docerr

Summary:

In the “Microsoft Windows Software Development Kit Guide to Programming,” page 16-13 incorrectly states:

The largest object that can be allocated in 386 enhanced mode is 64 megabytes.

This is an error in the documentation. The actual limit for a single object is 16,711,680 bytes [16 megabytes (MB) minus 64 kilobytes (K)].

More Information:

Huge memory blocks are limited to (16 MB - 64K) in 386 enhanced mode because of the way global arena headers are implemented.

GlobalAlloc may incorrectly return a non-NULL handle when allocating objects larger than (16 MB - 64K). However, any attempt to access portions of the object beyond the limit will result in a general protection violation (reported in Windows as an Unrecoverable Application Error).

Note that GlobalSize will return the true size of the memory allocated to the handle. For example, an application might request an allocation of 20 MB, but GlobalSize will report how much memory was actually allocated, a figure less than or equal to (16 MB - 64K).