PRB: _PageAllocate May Fail to Allocate Memory Blocks

Last reviewed: February 6, 1998
Article ID: Q180579
The information in this article applies to:
  • Windows 95 Device Driver Kit (DDK), version 4.0

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

Version           : WIN95
Platform          : Win95
Issue type        : kbprb


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 6, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.