PRB: _PageAllocate May Fail to Allocate Memory Blocks

ID: Q180579

The information in this article applies to:

SYMPTOMS

The virtual machine manager (VMM) service _PageAllocate may fail when you attempt to allocate memory, even when there is enough free memory available in the system. This problem is most common when you are trying to allocate large memory blocks.

CAUSE

maxPhys is documented in the Windows 95 DDK as:

   Maximum acceptable physical page number in the memory block. All page
   numbers must be less than this value. This parameter is used only if the
   flags parameter specifies the PAGEUSEALIGN value.

Since maxPhys is a page number, the maximum valid value for maxPhys is 0x100000. However, if _PageAllocate is called with a maxPhys value of 0xffffffff, the service does not fail due to the invalid parameter. Instead, it attempts to allocate the memory below 16MB using a maxPhys value of 0x1000.

This behavior can cause _PageAllocate to fail mysteriously, particularly for large memory blocks. If you attempt to allocate a large memory block (for example, 16MB (0x1000 pages) of memory) and specify a maxPhys value of 0xffffffff, _PageAllocate will always fail, even if there is sufficient free memory in the system.

Specifying 0xffffffff for the maxPhys parameter is a common error when you fail to recognize that the parameter requires a page number, not a full physical address. If you run the debug version of vmm.vxd, it displays the following messages that can help you identify this problem:

     PageAllocate: maxphys parameter greater than 4gig (0x100000)
     PageAllocate: maxphys = -1, remapping to 16meg

RESOLUTION

The maximum value that should be specified for maxPhys is 0x100000.

STATUS

This behavior is by design.

REFERENCES

Windows 95 Device Driver Kit: _PageAllocate

Additional query words:

Version           : WIN95
Platform          : Win95
Issue type        : kbprb

Last Reviewed: June 24, 1998